Coder Perfect

Duplicate AssemblyVersion Attribute


I have a project that compiles with the following error:

I investigated the AssemblyInfo.cs file and it appears that there is no duplication.

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 only true when there are 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">

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

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

Solution #5

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("")]

Answered by Pantelitsa Mavrovounioti

Post is based on