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">
<PropertyGroup>
<TargetFrameworks>net5.0-windows</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AssemblyName>DSAUCEx1_1Net5</AssemblyName>
<RootNamespace>DSAUCEx1_1</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\DSAUCEx1_1***.cs" />
<EmbeddedResource Include="..\DSAUCEx1_1***.resx" />
</ItemGroup>
</Project>
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" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
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.