question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need better error message when generated assembly info collides with one in source.

See original GitHub issue

I usually generate assembly information (such as version, informational version, etc) with custom tasks. However, when trying to use these with the SDK, it fails with errors such as Duplicate 'AssemblyVersion' attribute. If I add <GenerateAssemblyInfo>false</GenerateAssemblyInfo> to the csproj it is built with no issue and my custom generated versions are available.

A simple way to reproduce this is to add the GitVersionTask to the project and attempt to build.

The SDKs I’m using are:

<PackageReference Include="Microsoft.NET.Sdk">
  <Version>1.0.0-alpha-20161104-2</Version>
  <PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Sdk.Web">
  <Version>1.0.0-alpha-20161104-2-112</Version>
  <PrivateAssets>All</PrivateAssets>
</PackageReference>

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
twsouthwickcommented, Nov 29, 2016

This is a regression from previous behavior - an even simpler repro is add the following to a file:

[assembly: System.Reflection.AssemblyInformationalVersion("test")]

This is how assembly information is added in all other .NET projects and is now broken with the new SDK without adding this property. The assembly level attributes should only be created if they are not already available.

1reaction
rkeithhillcommented, Jul 17, 2017

Perhaps we just need some guidance on the landing page for this error:

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0579

I tried to add a community comment:

If you get this error on one of the Assembly-level attributes such as AssemblyCompanyAttribute in a .NET Core/Standard project, the error might be occurring because you are compiling a “ported” AssemblyInfo.cs file with these attributes.

The new CSPROJ / MSBuild / SDK project system automatically generate these attributes which is why you get “duplicate attribute” errors when porting a project from the old build system to the new build system.  You can tell the new project system to skip auto-generating these attributes with <GenerateAssemblyInfo>false</GenerateAssemblyInfo>.

But the site wouldn’t accept my Hotmail account. Go figure. Anyway, I think this would be enough to address the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source file 'Properties\AssemblyInfo.cs' could not be found
I got the error using TFS, my AssemblyInfo wasn't mapped in the branch I was working on. This solved my problem. You should...
Read more >
AssemblyInfo.cs not being generated automatically
There is no AssemblyInfo.cs generated based on the project properties, but rather the assembly information is automatically injected into the ...
Read more >
Assembly definitions
A cyclical assembly reference exists when one assembly references a second assembly that, in turn, references the first assembly. Such cyclical references ...
Read more >
MSB3277: Found conflicts between different versions of ' ...
This error occurs during a build when more than one version of the same dependent assembly is referenced in a build of the...
Read more >
GCDS error messages - Google Workspace Admin Help
GCDS is running as a different user to the one that installed GCDS. Permissions have changed since installation. org.jdom.input. JDOMParseException: Error on ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found