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

Dante Santos 5 Reputation points
Feb 27, 2024, 4:42 PM

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,337 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,181 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,015 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Michael Taylor 55,766 Reputation points
    Feb 27, 2024, 5:37 PM

    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
    Oct 10, 2024, 11:24 PM

    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.