ASP .NET Core

ASP .NET Core: Introduction

ASP.NET Core is the new web framework from Microsoft. ASP.NET Core is the framework you want to use for web development with .NET. At the end this tutorial, you will have everything you need to start using ASP.NET Core and write an application that can create, edit, and view data from a database.


How to Port from .NET Framework to .NET Core


1. Analyze Third Party Dependencies: This involves more than just knowing what the third party dependencies are. There needs to be an understanding of how the app depends on those third party dependencies if they run on .NET Core, and what needs to be if they do not run.New with .NET Core 2.0, a compatibility shim can make it possible to reference .NET Framework packages that have not been switched to use .NET Standard. Be sure to thoroughly test these packages as they may still have issues if they use unsupported APIs.

2. Target the .NET Standard Library: The .NET Standard library is intended to be available on all .NET runtimes, so targeting the .NET Standard library is the best way to build a cross-platform class library. There are multiple versions to consider that are available to varying degrees across eight platforms. If a project targets a lower version, it cannot reference a project that targets a higher version. Pick the lowest possible .NET Standard version to use across all projects.

3. Retarget Projects: All the projects to be ported need to be targeted to .NET Framework 4.6.2. This will ensure API alternatives for .NET Framework specific targets can be used for non-supported APIs. This is done easily in Visual Studio with a “Target Framework” command and recompiling the projects.

4. Port Tests Code Porting code to .NET Core is a significant change; testing is strongly encouraged. Use a suitable testing framework such as:
- xUnit
- NUnit
- MSTest

5. Execute the Porting Plan The best way to port the code depends on how the framework is structured. But breaking the code base into steps and layers should work well.
- Identify the “base” of the library. This base could be the data models or classes and methods that everything else needs to use.
- Copy the base into a new .NET Core project.
- Make any changes needed to compile the code.
- Copy another layer of code and repeat.