Problem
I have a project that compiles with the following error:
I have checked the file AssemblyInfo.cs and it looks like there is no duplication there.
This post on MSDN tackles a similar issue, and following the advice in this article resolves the issue as well.
Is there anyone who can tell me what’s going on here? Is this simply a problem if you have two or more projects with classes with the same name? Is it something else entirely?
Asked by Aamir
Solution #1
Another way to keep utilizing the AssemblyInfo.cs file starting with Visual Studio 2017 is to disable automated assembly info generation like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
</Project>
Personally, I find it really handy for applications that require both.NET Framework and.NET Standard compatibility.
Answered by Serge Semenov
Solution #2
Because I’ve had this problem before, I’m going to presume that your build process gives assembly information in addition to versioning. And this creates a duplicate because the AssemblyInfo.cs file in your project also contains that information. So, I believe it will function if you remove the file.
Answered by luqi
Solution #3
Most of the information in AssemblyInfo.cs can now be adjusted on the project itself when converting an older project to.NET Core. To see the new settings, open the project properties and go to the Package tab.
Three options are described in Eric L. Anderson’s post “Duplicate ‘System.Reflection.AssemblyCompanyAttribute’ attribute”:
Answered by Michael Freidgeim
Solution #4
I had the same problem, and it was underlining the Assembly Version and Assembly File Version, so after reading Luqi’s response, I just inserted them as comments, and the problem was cured.
// 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")]
Answered by Pantelitsa Mavrovounioti
Solution #5
In my scenario, a project folder had a subdirectory that was also a project folder:
Then I had to delete the “webapi” project’s subfolder “testing.”
Answered by heringer
Post is based on https://stackoverflow.com/questions/10311347/duplicate-assemblyversion-attribute