Porting to .NET Core from .NET Framework
If you've got code running on the .NET Framework, you may be interested in running your code on .NET Core. This article covers an overview of the porting process and a list of the tools you may find helpful when porting to .NET Core.
Overview of the Porting Process
The recommended process for porting follows the following series of steps. Each of these parts of the process are covered in more detail in further articles.
Identify and account for your third-party dependencies.
This will involve understanding what your third-party dependencies are, how you depend on them, how to see if they also run on .NET Core, and steps you can take if they don't.
Retarget all projects you wish to port to target the latest version of .NET Framework.
This ensures that you can use API alternatives for .NET Framework-specific targets in the cases where .NET Core can't support a particular API.
Use the .NET Portability Analyzer to analyze your assemblies and develop a plan to port based on its results.
The API Portability Analyzer tool will analyze your compiled assemblies and generate a report which shows a high-level portability summary and a breakdown of each API you're using that isn't available on .NET Core. You can use this report alongside an analysis of your codebase to develop a plan for how you'll port your code over.
Port your tests code.
Because porting to .NET Core is such a big change to your codebase, it's highly recommended to get your tests ported so that you can run tests as you port code over. MSTest, xUnit, and NUnit all support .NET Core today.
Execute your plan for porting!
Tools to help
Here's a short list of the tools you'll find helpful:
- NuGet - Nuget Client or NuGet Package Explorer, Microsoft's package manager for .NET implementations.
- Api Portability Analyzer - command line tool or Visual Studio Extension, a toolchain that can generate a report of how portable your code is between .NET Framework and .NET Core, with an assembly-by-assembly breakdown of issues. See Tooling to help you on the process for more information.
- Reverse Package Search - A useful web service that allows you to search for a type and find packages containing that type.