Duplicate AssemblyVersion Attribute
Starting from Visual Studio 2017 another solution to keep using the AssemblyInfo.cs
file is to turn off automatic assembly info generation like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
I personally find it very useful for projects which need to support both .NET Framework and .NET Standard.
I have also run into this issue in the past, so I am going to assume that your build process provides assembly information separately to providing versioning. And that causes a duplication as your project also has that info in the AssemblyInfo.cs
file. So remove the file and I think it should work.
When converting an older project to .NET Core, most of the information that was in the AssemblyInfo.cs can now be set on the project itself. Open the project properties and select the Package tab to see the new settings.
The Eric L. Anderson's post "Duplicate ‘System.Reflection.AssemblyCompanyAttribute’ attribute" describes 3 options :
- remove the conflicting items from the AssemblyInfo.cs file,
- completely delete the file or
- disable GenerateAssemblyInfo (as suggested in another answer by Serge Semenov)
I had the same error and it was underlining the Assembly Vesrion and Assembly File Version so reading Luqi answer I just added them as comments and the error was solved
// AssemblyVersion is the CLR version. Change this only when making breaking changes
//[assembly: AssemblyVersion("3.1.*")]
// AssemblyFileVersion should ideally be changed with each build, and should help identify the origin of a build
//[assembly: AssemblyFileVersion("3.1.0.0")]