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.

Duplicate Targetframework attribute

See original GitHub issue

I have similary problems with that issue. It started when i run npm install. Packages installation finished with error then dotnet build got error I tried deleting the obj and use dotnet clean. It is not helped me.

Steps to reproduce

npm install
dotnet build

Expected behavior

Successful build

Actual behavior

/tmp/.NETCoreApp,Version=v2.1.AssemblyAttributes.cs(4,12): error CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute [/root/betprofit-server/VFL.Web/VFL.Web.csproj]

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json):
 Version:   2.1.402
 Commit:    3599f217f4

Runtime Environment:
 OS Name:     debian
 OS Version:  8
 OS Platform: Linux
 RID:         debian.8-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.402/

Host (useful for support):
  Version: 2.1.4
  Commit:  85255dde3e

.NET Core SDKs installed:
  2.1.2 [/usr/share/dotnet/sdk]
  2.1.402 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
livarcocccommented, Oct 1, 2018

I am not sure why npm install would interfere with this at all. Do you have any customization in your project that might be causing this?

Could you share with us a binlog? dotnet build /bl, should generate a .binlog file that you could share with us. Do notice that if you do, the binlog logs secrets and things like that, so make sure you don’t have any in your build before sharing.

Without a binlog or a repro we can reproduce ourselves, there isn’t much we can do.

You can try setting <GenerateAssemblyInfo>false</GenerateAssemblyInfo> in your project, so see if the file stops being generated and your build succeeds.

0reactions
livarcocccommented, Oct 1, 2018

I am going to close this issue then. Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error CS0579 Duplicate 'global::System.Runtime. ...
Runtime.Versioning.TargetFrameworkAttribute'". So, to fix this error, we just have to follow the preceding steps. Create a folder with the same ...
Read more >
error CS0579: Duplicate 'global::System.Runtime. ...
After run command dotnet build, I got an error that Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute in ...
Read more >
Duplicate 'global::System.Runtime.Versioning. ...
[regression] [worked-in:16.5.5] I have an SDK-style project that targets net45 and netstandard2.0. The project uses a workaround listed here ...
Read more >
Error - CS0579 Duplicate '<type>Attribute'
On a recent project I got the "CS0579 Duplicate 'global::System.Runtime.Versioning. ... TargetFrameworkAttribute' attribute MyAzureFunction ...
Read more >
About migrating from .NET Framework 7.4.2 to .NET 5.0 Error
NET 5.0 version of the project, I get compiler error “CS0579: Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' ...
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