简体   繁体   English

如何在 Visual Studio 中将 .NET Framework 更改为 .NET Standard/Core?

[英]How to change .NET Framework to .NET Standard/Core in Visual Studio?

I have a solution in C# in Visual Studios.我在 Visual Studios 中有一个 C# 解决方案。 It was first created in .NET Framework.它最初是在 .NET Framework 中创建的。 I want to convert the project to .NET Standard/Core.我想将项目转换为 .NET Standard/Core。 If I go into project --> properties I see the attached screen, where Target Framework is .NET Framework.如果我进入项目 --> 属性,我会看到附加的屏幕,其中 Target Framework 是 .NET Framework。 How am I able to change that to .NET Standard/Core?我如何才能将其更改为 .NET Standard/Core?

项目 --> 属性:目标框架当前设置为 .NET Framework

As Roman Ryzhiy mentions in the comments, this is the way to go:正如 Roman Ryzhiy 在评论中提到的,这是要走的路:

https://docs.microsoft.com/en-us/dotnet/core/porting/ https://docs.microsoft.com/en-us/dotnet/core/porting/

This worked fine for me, I upgraded a .NET Framework 4.7.2 projekt.这对我来说很好用,我升级了 .NET Framework 4.7.2 项目。 It was a small project, so I had few aftermath-problems.这是一个小项目,所以我几乎没有什么后果问题。 After the upgrade, the Target Framework in the Application tab will say ".NET 5.0".升级后,应用程序选项卡中的目标框架会显示“.NET 5.0”。

  1. Install upgrade-assistant:安装升级助手:

    dotnet tool install -g upgrade-assistant dotnet 工具安装 -g 升级助手

  2. Go to your solution folder转到您的解决方案文件夹

  3. Run the assistant:运行助手:

    upgrade-assistant upgrade your-project-name.csproj升级助手升级您的项目名称.csproj

  4. Follow the steps in the assistant, it's really straight-forward.按照助手中的步骤操作,非常简单。

Also, here are the steps more detailed:此外,以下是更详细的步骤:

https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview#installation-steps https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview#installation-steps

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 Visual Studio 2019 中的 .NET 版本更改为 .NET Framework 4.7.2? - How to change .NET version in Visual Studio 2019 to .NET Framework 4.7.2? 如何从Visual Studio 2017中的.NET Framework 4.5控制台应用程序引用.NET标准库? - How Do You Reference a .NET Standard Library from a .NET Framework 4.5 Console Application in Visual Studio 2017? 如何使用Visual Studio代码将实体框架核心安装到asp.net核心3项目 - How to install entity framework core to asp.net core 3 project using visual studio code .net 标准库在 .net 核心中失败,但在框架中失败 - .net standard library fails in .net core but not in framework 如何将 .NET 标准库更改为 .NET 框架库? - How can I change a .NET standard library to a .NET framework library? .NET Core 2.0 不是 Visual Studio Target Framework 中的一个选项 - .NET Core 2.0 Is Not An Option in Visual Studio Target Framework .NET 核心未显示在 Visual Studio 2022 的目标框架下拉列表中 - .NET Core not showing in target framework dropdown for visual studio 2022 无法在 Visual Studio Build Framework 中选择 .NET Core 2.2 - .NET Core 2.2 Can't be Selected In Visual Studio Build Framework 无法在 .NET 5 和 Visual Studio Code 中引用 Entity Framework Core - Can't reference Entity Framework Core in .NET 5 and Visual Studio Code 如何在Visual Studio 2017中将PCL更改为.net平台标准库? - How can I change a PCL into a .net Platform Standard Library in Visual Studio 2017?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM