当我尝试将我的WPF应用程序转换到.NET 5时,我得到了以下信息。
有谁能给我引路吗?
C:\WINDOWS\system32>try-convert -p "D:\ClientNew\Routines\Routines.csproj"
Multiple installs of MSBuild detected please select one:
Instance 1
Name: .NET Core SDK
Version: 5.0.302
MSBuild Path: C:\Program Files\dotnet\sdk\5.0.302\
Instance 2
Name: .NET Core SDK
Version: 2.1.524
MSBuild Path: C:\Program Files\dotnet\sdk\2.1.524\
Instance 3
Name: .NET Core SDK
Version: 2.1.202
MSBuild Path: C:\Program Files\dotnet\sdk\2.1.202\我也关注了Multiple installs of MSBuild,但没有太多帮助。
> C:\WINDOWS\system32>try-convert -w Routines.csproj --target-framework
> net5.0 -m "C:\Program Files\dotnet\sdk\5.0.302"
> System.AggregateException: A directory or directories in
> "msbuildSearchPaths" do not exist (Directory "C:\Program
> Files\dotnet\sdk\5.0.302"" does not exist (Parameter
> 'msbuildSearchPaths')) ---> System.ArgumentException: Directory
> "C:\Program Files\dotnet\sdk\5.0.302"" does not exist (Parameter
> 'msbuildSearchPaths') --- End of inner exception stack trace ---
> at Microsoft.Build.Locator.MSBuildLocator.RegisterMSBuildPath(String[]
> msbuildSearchPaths) at
> Microsoft.Build.Locator.MSBuildLocator.RegisterMSBuildPath(String
> msbuildPath) at
> MSBuild.Abstractions.MSBuildHelpers.HookAssemblyResolveForMSBuild(String
> msbuildPath) in /_/src/MSBuild.Abstractions/MSBuildHelpers.cs:line 405
> at MSBuild.Conversion.Program.Run(String project, String workspace,
> String msbuildPath, String tfm, Boolean forceWebConversion, Boolean
> preview, Boolean diffOnly, Boolean noBackup, Boolean keepCurrentTfms,
> Boolean update, Boolean mauiConversion) in
> /_/src/try-convert/Program.cs:line 93我还安装了upgrade-assistant,现在尝试使用这个命令。我收到Required command was not provided错误:
C:\Users\rya\Test>upgrade-assistant C:\Users\rya\Test\Client\Screen.sln
Required command was not provided.
Unrecognized command or argument 'C:\Users\rya\Test\Client\Screen.sln'发布于 2021-08-10 08:37:41
这似乎是因为转换工具想知道要使用哪个版本的MSBuild。
这个问题:Dotnet project conversion try-convert fails when "Multiple installs of MSBuild"有一些关于如何指示工具应该使用哪个版本的信息,尽管到目前为止它还没有一个公认的答案。
https://stackoverflow.com/questions/68723428
复制相似问题