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 :
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")]
In my case, there where a subfolder in a project that was a project folder it self:
file system:
solution
Then i had to remove the subfolder "tests" from the "webapi" project.
In my case, some temporary *.cs files generated during compilation got accidentally added to the project.
The files were from the obj\Debug
directory, so they definitely shouldn't have been added to the solution. A *.cs
wildcard went a little crazy and added them incorrectly.
Deleting these files fixed the problem.
There must be already a AssemblyInfo.cs file in the project here:
To solve: - Delete any one AssemblyInfo.cs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With