首页 > 解决方案 > is there any way to detect windows environment based function in our project?

问题描述

In my project i have to create platform independent code. My project(Based on .net framework 4.6.1 which i have convert it into .net core 3.1) was developed long ago and its based on windows environment now we convert it into Linux and Mc environment also. so is there any way to detect all windows specific classes so we can change it for Mc and Linux also or we just read the entire code and find each function and convert it. because its very time taken process to read entire code and change according to requirement so is there any other way to do it?

标签: asp.net-core.net-coreasp.net-core-3.1.net-core-3.1

解决方案


首先查看这篇文章从 .NET Framework 移植到 .NET Core 的概述

那么有什么方法可以检测所有特定于 Windows 的类,以便我们也可以为 Mc 和 Linux 更改它,或者我们只需阅读整个代码并找到每个函数并转换它。

.NET 可移植性分析器是一种分析程序集并提供有关 .NET API 的详细报告的工具,这些 API 是为了在您指定的目标上可移植的应用程序或库而缺失的。

try-convert是有助于将 .NET Framework 项目迁移到 .NET Core 的工具。



在 Linux 和 Mac 平台上运行

.NET Core是跨平台的,它运行在macOSLinuxWindows. .NET Core支持前面提到的操作系统作为您的开发工作站。有了.NET Core您,您可以定位在任何平台上运行的任何应用程序类型。Visual Studio 为 Windows 和 macOS 提供集成开发环境 (IDE)。您还可以使用Visual Studio Code,它在macOSLinuxWindows.

服务器应用程序的 .NET Core 与 .NET Framework


推荐阅读