Duplicate AssemblyVersion Attribute

Aamir picture Aamir · Apr 25, 2012 · Viewed 121.6k times · Source

I have a project that generates following error on compilation:

error CS0579: Duplicate 'AssemblyVersion' attribute

I have checked the file AssemblyInfo.cs and it looks like there is no duplication there.

I found this article on MSDN which addresses a similar problem and following the suggestion in this article fixes the problem as well.

Can anyone tell me what's going on here? Does it happen only in case of having two or more projects with classes having similar names? Or is it something else?

Answer

Serge Semenov picture Serge Semenov · Jun 12, 2017

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.