About migrating from .NET Framework 7.4.2 to .NET 5.0 Error

Nicholas Piazza 536 Reputation points

After verifying portability of my .NET Framework 4.7.2 application to .NET 5.0, I tried using the instructions from How to Migrate from the .NET Framework to .NET 5 Controls | ComponentOne (grapecity.com). I created the new folder and the new project. However, when I try to build the .NET 5.0 version of the project, I get compiler error “CS0579: Duplicate ‘global::System.Runtime.Versioning.TargetFrameworkAttribute’ attribute’ as shown below.

// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")]

My project file is as follows:

<Project Sdk="Microsoft.NET.Sdk">
<Compile Include="..\DSAUCEx1_1***.cs" />
<EmbeddedResource Include="..\DSAUCEx1_1***.resx" />

Can you tell me what I need to do to fix this problem? Also, I would like to know what to do with my existing app.config file which references the old framework. I suspect I need a modified version of that for the new .NET 5.0 project. The app.config file is shown below.

<?xml version="1.0" encoding="utf-8" ?>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />

Here is the link to those instructions I used: https://www.grapecity.com/blogs/how-to-migrate-from-the-dot-net-framework-to-dot-net-5-controls

Appreciate any help you could give me.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,857 questions
0 comments No comments
{count} votes

Accepted answer
  1. Daniel Zhang-MSFT 9,621 Reputation points

    Hi NicholasPiazza-0093,
    You can add the following line to the <PropertyGroup> to fix the problem.


    If not successful, you can try the other methods in this thread.
    About porting from .NET Framework to .NET Core, I suggest you follow this document.
    And you can also try the try-convert to migrate.
    More suggestions in this thread you can refer to.
    Best Regards,
    Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful