.net core compatibility windows windows compatible Linux

时间:2022-01-01 07:53:23

标签:

Who is this package for?

This package is meant for developers that need to port existing .NET Framework code to .NET Core. But before you start porting, you should understand what you want to accomplish with the migration. Just porting to .NET Core because it’s a new .NET implementation isn’t a good enough reason (unless you’re a True Fan).

.NET Core is optimized for building highly scalable web applications, running on Windows, macOS or Linux. If you’re building Windows desktop applications, then the .NET Framework is the best choice for you. Take a look at our documentation for more details on how to choose between .NET Core and .NET Framework.

Demo

For a demo, take a look at this video:

Using the Windows Compatibility Pack

We highly recommend that you plan your migrations as a series of steps instead of assuming you can port the existing code base all at once. If you’re planning to migrate an ASP.NET MVC application running on a local Windows server to an ASP.NET Core application running on Linux in Azure, we’d recommend you perform these steps:

Migrate to ASP.NET Core (while still targeting the .NET Framework)

Migrate to .NET Core (while staying on Windows)

Migrate to Linux

Migrate to Azure

The order of steps might vary, depending on your business goals and what value you need to accomplish first. For example, you might need to deploy to Azure before you perform the other migration steps. The primary point is that you perform one step at a time to ensure your application stays operational along the way. This reduces the complexity and churn you have to reason about at once. It also allows you to learn more about your code base and adjust your plans as you discover issues.

The Porting to .NET Core from .NET Framework documentation provides more details on the recommended process and which tools you can use.

Before bringing existing .NET Framework code to a .NET Core project, we recommend you first add the Windows Compatibility Pack by installing the NuGet package Microsoft.Windows.Compatibility. This maximizes the number of APIs you have at your disposal.

The Windows Compatibility Pack is currently in preview because it’s still a work in progress. The following table describes the APIs that are already part of the Windows Compatibility Pack or are coming in a subsequent updat

ComponentStatusWindows-OnlyComponentStatusWindows-Only
Microsoft.Win32.Registry   Available   Yes   System.Management   Coming   Yes  
Microsoft.Win32.Registry.AccessControl   Available   Yes   System.Runtime.Caching   Coming      
System.CodeDom   Available       System.Security.AccessControl   Available   Yes  
System.ComponentModel.Composition   Coming       System.Security.Cryptography.Cng   Available   Yes  
System.Configuration.ConfigurationManager   Available       System.Security.Cryptography.Pkcs   Available   Yes  
System.Data.DatasetExtensions   Coming       System.Security.Cryptography.ProtectedData   Available   Yes  
System.Data.Odbc   Coming       System.Security.Cryptography.Xml   Available   Yes  
System.Data.SqlClient   Available       System.Security.Permissions   Available      
System.Diagnostics.EventLog   Coming   Yes   System.Security.Principal.Windows   Available   Yes  
System.Diagnostics.PerformanceCounter   Coming   Yes   System.ServiceModel.Duplex   Available      
System.DirectoryServices   Coming   Yes   System.ServiceModel.Http   Available      
System.DirectoryServices.AccountManagement   Coming   Yes   System.ServiceModel.NetTcp   Available      
System.DirectoryServices.Protocols   Coming       System.ServiceModel.Primitives   Available      
System.Drawing   Coming       System.ServiceModel.Security   Available      
System.Drawing.Common   Available       System.ServiceModel.Syndication   Coming      
System.IO.FileSystem.AccessControl   Available   Yes   System.ServiceProcess.ServiceBase   Coming   Yes  
System.IO.Packaging   Available       System.ServiceProcess.ServiceController   Available   Yes  
System.IO.Pipes.AccessControl   Available   Yes   System.Text.Encoding.CodePages   Available   Yes  
System.IO.Ports   Available   Yes   System.Threading.AccessControl   Available   Yes  
Handling Windows-only APIs