try-convert
try-convert copied to clipboard
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
After watching the .Net Conf demo I tried to convert a medium sized solution containing a WPF app and some libraries and unit test projects. The projects are .Net-Framework 4.7.2.
dotnet --version
5.0.100
dotnet tool list -g
Package Id Version Commands
----------------------------------------------------------------------------
apiport 2.8.14 ApiPort
try-convert 0.7.157502 try-convert
When running try-convert -w [solution_name]
I got the following error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at MSBuild.Abstractions.MSBuildConversionWorkspaceLoader.LoadWorkspace(String path, Boolean noBackup, String tfm, Boolean keepCurrentTFMs, Boolean forceWeb)
at MSBuild.Conversion.Program.Run(String project, String workspace, String msbuildPath, String tfm, Boolean forceWebConversion, Boolean preview, Boolean diffOnly, Boolean noBackup, Boolean keepCurrentTfms) in /_/src/try-convert/Program.cs:line 103
Thanks for the effort of creating this tool 👍 Regards, Anton
Hey @sqeezy can you verify that this still happens with the latest version of the tool?
The error would indicate that you don't have an appropriate MSBuild installed. Is Visual Studio installed on your machine? If not, it also is likely required to install.
Version 0.7.157502 seems to be the latest version of the tool. At least I could not find a newer one even with adding --prerelease
while searching. The machine I'm trying this on has multiple versions MSBuild installed. I updated Visual Studio and Visual Studio Buildtools to 16.8.3 and still get the same error.
would you happen to know if the project you're converting specifies a specific version of an msbuild toolset? e.g. like this https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-toolset-toolsversion?view=vs-2019
If so, what happens if you remove it?
I removed all the toolset version entries from csproj-files. The same error message was shown afterwards.
If you are running in a developer prompt, try-convert apparently fails to find MSBuild. The solution for me was to specify the path directly using -m "C:\Program Files\dotnet\sdk\5.0.201
(your SDK path may be different).