Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Windows compatibility Pack to simplify Migration to .NET Core

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to use Windows compatibility packages to simplify the migration to .NET Core. Many people may not know much about it. In order to make you understand better, the editor summarized the following. I hope you can get something from this article.

One of the main reasons for migrating from .NET to .NET Core is that the latter has the ability to run on Linux. However, for large enterprise applications, it is impossible to achieve one-step migration. Therefore, Microsoft recommends a step-by-step migration approach:

The first step is to migrate to ASP.NET Core (still using .NET Framework)

Second, migrate to .NET Core (still running on Windows)

Step 3, migrate to Linux

The fourth step is to migrate to the Azure that hosts the Linux host.

This is theoretically feasible, but there will be obstacles in the second step because of the lack of key API. The introduction of the Windows compatibility Pack for .NET Core is intended to solve this problem. The compatibility package is a collection of NuGet packages containing nearly 20, 000 API designed to address the needs of Web application developers for excellent software libraries.

The newly introduced API can be broadly divided into two categories. One is API only for Windows, and the other is cross-platform software libraries. Among them, the API that applies only to Windows includes:

Active directory

Encrypt

Event logs and performance counters

File system security

Named pipe

Registry access (Registry Access)

Windows service.

Most of these API are closely related to the Windows operating system, and the corresponding Linux API is usually very different in design.

Cross-platform software libraries include:

Caching

Configuration management (ConfigurationManager), that is, processing legacy app.config and web.config files

Dataset extension (DatasetExtensions) for accessing databases without using ORM

ODBC database access

System.Configuration.ConfigurationManager (MEF v1)

System.Drawing

System.IO.Packaging, used to interact with compressed files of type MS Office

System.ServiceModel, or WCF (Windows Communication Foundation).

It is important to note that these API are deliberately released independently of the full release of the .NET Core. Microsoft's Immo Landwerth gives the following explanation:

The reasons for providing stand-alone software packages are: (1) many API are provided only for compatibility reasons. In the new code, you should not rely on these API; (II) many API are only used on the Windows platform. We don't want to lead users to a path where it is more difficult to migrate applications across platforms.

To make it easy to distinguish between Windows-only and cross-platform API, an API compatibility analysis tool is now available. The tool can mark API that should no longer be relied on in the application.

You can use the same suppression options as deprecated API, but you can also choose to give suppression warnings to specific platforms. This tool is useful if you plan to support your code on only a specific set of platforms, such as only Windows and Linux but not macOS. To do this, you just need to edit the project file, add a PlatformCompatIgnore attribute, and list all platforms to ignore in that attribute.

After reading the above, do you have any further understanding of how to use Windows compatibility packs to simplify the migration to .NET Core? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report