The easiest thing you can do IMHO is make the core project and copy the classes from the old project to the core project. Then you'll have to figure out what namespaces a class you copied over to code is not valid in Core and either find the Core equivalent or remove the namespace altogether.
How to Migrate .Net Framework to .Net core application
Hi,
I have an desktop application with .Net framework 4.5 using Visual Studio 2015.
I want to convert .Net framework 4.5 application(desktop) to .Net Core 3.1 console application in Visual studio 2019
How to approach this?
Please help me on this
3 answers
Sort by: Most helpful
-
-
Karen Payne MVP 35,551 Reputation points
2021-03-23T15:37:15.82+00:00 Hello,
To create a .NET Core 3.1 console project you need Visual Studio 2019 as Visual Studio 2015 and Visual Studio 2017 don't support .NET Core 3.1
Also note that references are done differently in .NET Core than .NET Framework e.g. lets say you need to connect to a database, (not saying you do) in .NET Framework the reference is in the project while in .NET Core you need to add an NuGet package.
Otherwise if you are not doing much outside normal coding you'll be fine.
Plain Jane project file
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> </Project>
With a database provider
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <TargetFramework>netcoreapp3.1</TargetFramework> </PropertyGroup> <ItemGroup> <PackageReference Include="System.Data.SqlClient" Version="4.8.2" /> </ItemGroup> </Project>
-
Ken Tucker 5,856 Reputation points
2021-03-28T10:23:37.387+00:00 At the .net conf focus on windows they talked about a tool the upgrade assistant. It helps move .net framework desktop apps to .net 5. Maybe you could move it to .net 5 and then change the target framework to .net core 3.1