Dotnet project conversion try-convert fails when "Multiple installs of MSBuild"

Viewed 1447
try-convert -w Test.csproj --target-framework netstandard2.0

results in:

Multiple installs of MSBuild detected please select one:

...
Instance 6
    Name: .NET Core SDK
    Version: 3.0.100
    MSBuild Path: C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\

But specifying one of those paths

try-convert -w Test.csproj --target-framework netstandard2.0 -m "C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\"

results in :

Exceptions

System.ArgumentException: Directory "C:\Program Files\dotnet\sdk\3.0.100-preview7-012821"" does not exist (Parameter 'msbuildSearchPaths')
A directory or directories in "msbuildSearchPaths" do not exist
2 Answers

Remove the trailing slash from the MSBuild path:

try-convert -w Test.csproj --target-framework netstandard2.0 -m "C:\Program Files\dotnet\sdk\3.0.100-preview7-012821"

Thank you, I had the same problem. When I used "try-convert" it requested to choose a instance of .NET, but I couldn't type anything. When I tried to use "--target-framework" it didn't help me, but "-m" works great.

try-convert -w "Test.csproj" -m "C:\Program Files\dotnet\sdk\5.0.400"

You can use "--no-backup" if your code was published in source control (git, svn and etc).

Related