Convert .Net Framework 4.6.2 project to .Net core project

karthikraja picture karthikraja · Jan 2, 2018 · Viewed 36.3k times · Source

I Have a solution which contains the bunch of class libraries which is developed by .Net framework 4.6.2. I have to convert those class libraries into .Net core. Is there any best and fastest way to convert instead for rewrite the code.

Answer

pushkin picture pushkin · Dec 19, 2019

This appears to be an official Microsoft resource for doing the migration. Summarized below:

  1. (recommended) Retarget all projects you wish to port to target the .NET Framework 4.7.2 or higher.

  2. (recommended) Use the .NET Portability Analyzer to analyze your assemblies and see if they're portable to .NET Core.

  3. (recommended) Install the .NET API analyzer into your projects to identify APIs throwing PlatformNotSupportedException on some platforms and some other potential compatibility issues.

  4. Convert all of your packages.config dependencies to the PackageReference format with the conversion tool in Visual Studio.

  5. Create new projects for .NET Core and copy over source files, or attempt to convert your existing project file with a tool.

  6. Port your test code.