Facing "Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute

Dante Santos 5 Reputation points
2024-02-27T16:42:58.3133333+00:00

I have been facing the error below and have been following the main threads on Google. I've tried to delete the obj and bin folders and Rebuild the project, also updated Visual Studio, but I was not successful. Thanks for all of you that can help. Error:CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute KilnDesktopApp C:\Users\xxx\Desktop\Kiln-Desktop-App\obj\Debug.NETFramework,Version=v4.7.2.AssemblyAttributes.cs

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,201 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,027 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
1,004 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Michael Taylor 54,896 Reputation points
    2024-02-27T17:37:16.9033333+00:00

    Sounds like you have both an AssemblyInfo.cs file and possibly have enabled auto-generating the assemblyinfo file by the build. Please confirm you have not enabled the auto-generation of the assemblyinfo file, or alternatively ensure you don't have an AssemblyInfo.cs file as well.


  2. Ajay KN 0 Reputation points
    2024-10-10T23:24:32.13+00:00

    I have created .net core mvc project in visual studio 2022 with framework 8 LTS and added xunit project to same as a subfolder like c:\mainproject and c:\mainproject\ testmainproject and started getting "Error CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute' attribute" error everything auto generated, I removed entire solution then

    I created .net core mvc project in visual studio 2022 with framework 8 LTS and added xunit project to diffent folder C:\MainProject and C:\TestMainProject now it's working properly

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.