dotnet build results in error CS0579 duplicate attributes with AssemblyVersionAttribute (and others) specified
See original GitHub issueBuilding a library project fails with error CS0579 (duplicate attribute) with library projects with AssemblyVersionAttribute
(or other assembly attributes) specified.
- Adding (for example)
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
to csproj fixes
Steps to reproduce
dotnet new -t lib
- insert
[assembly: System.Reflection.AssemblyVersion("0.1.0.0")]
into Library.cs dotnet restore
dotnet build
Expected behavior
Build is successful
Actual behavior
Build fails:
"C:\dsedev\src\AssemblyInfoTest\AssemblyInfoTest.csproj" (Build target) (1) ->
(CoreCompile target) ->
obj\Debug\netstandard1.4\AssemblyInfoTest.AssemblyInfo.cs(13,12): error CS0579: Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute [C:\dsedev\src\AssemblyInfoTest\AssemblyInfoTest.csproj]
Environment data
C:\dsedev\src\AssemblyInfoTest>dotnet --info
.NET Command Line Tools (1.0.0-preview3-004056)
Product Information:
Version: 1.0.0-preview3-004056
Commit SHA-1 hash: ccc4968bc3
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:14 (4 by maintainers)
Top Results From Across the Web
dotnet build results in error CS0579 duplicate attributes ...
Building a library project fails with error CS0579 (duplicate attribute) with library projects with AssemblyVersionAttribute (or other ...
Read more >VS 2017 Build Errors - Duplicate Attributes in AssemblyInfo ...
This happens because the new .NET tools automatically create the attributes and add them to the assembly, so they now appear twice in...
Read more >CS0579 Duplicate Attribute Error with .NET Core
The error is a result of the build process generating AssemblyInfo.cs files in each project obj directory. This file exists to provide MSBuild ......
Read more >Dealing with Duplicate Assembly Attributes in .Net Core
Severity Code Description Project File Line Suppression State Error CS0579 Duplicate 'System.Reflection.AssemblyTitleAttribute' attribute ...
Read more >Converting a simple solution/project to .NET Core
Trying the same (dotnet new classlib) on the test project produces slightly more mixed results... the same assembly attribute errors but then a ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Setting GenerateAssemblyInfo property to false fixes for all attributes:
This is a very odd error and unexpected - I got it by creating a new “console” type of project, a “library” type and then referencing the library from the console app.