繁体   English   中英

在 Visual Studio 2019 中升级 xproj

[英]Upgrading xproj in Visual Studio 2019

我需要在 Visual Studio 2019 中升级 xproj 类型的项目。 当我尝试打开解决方案时,它说它需要升级,但随后我收到以下消息:

不再支持 Xproj 项目文件。 有关迁移到 csproj 的详细信息,请参阅https://docs.microsoft.com/en-us/dotnet/core/migration/

链接的文档提到在 Visual Studio 中执行此操作(不起作用)或使用 dotnet migrate。 当我尝试这样做时,我得到以下信息:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-migrate does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

进一步看,dotnet migrate 似乎在 dotnetcore 3.0 中已被弃用

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

此命令已弃用。 从 .NET Core 3.0 SDK 开始,dotnet migrate 命令不再可用。 它只能将 Preview 2 .NET Core 项目迁移到 1.x .NET Core 项目,该项目不受支持。

我已经在 Visual Studio 2017 和 2015 命令行上尝试过,并得到完全相同的错误。 安装 dotnetcore3 似乎消除了执行此操作的能力。

有没有办法在不访问推荐的 Microsoft 工具的情况下迁移项目?

您可以通过以下命令列出已安装的 dotnet core sdk 版本:

dotnet --list-sdks

然后您可以通过以下命令切换回旧版本的 dotnet core sdk(例如2.0.2 ):

dotnet new globaljson --sdk-version 2.0.2

这应该在您的 xproj 所在的文件夹中执行。

最后,您可以通过以下方式迁移您的项目:

dotnet migrate

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM