microsoft / MSBuildLocator

An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
Other
212 stars 83 forks source link

Fix hostfx resolving issue in some Mac machines #236

Closed lifengl closed 10 months ago

lifengl commented 10 months ago

This PR is to fix hostfx resolver issue on some Mac machines. There are a few issues fixed in this PR:

1, the libraryName is actually the string from DllImport metadata, so it would be hostfxr 2, enumerate directory will get a list of full path, the semantic version parser doesn't seem to handle it. 3, DOTNET_HOST_PATH is actually path to the dotnet command file, which is different from DOTNET_ROOT, that was a misunderstanding in the code which leads it to set it incorrectly.

This PR is to address:

https://github.com/dotnet/msbuild/issues/9038

lifengl commented 10 months ago

cc @chzuluag

lifengl commented 10 months ago
lifengl commented 10 months ago

Both Christian and CTI has verified the PR fixed the issue on Mac (which can be produced on their x64 mac machine earlier.)

lifengl commented 10 months ago

@YuliiaKovalova , @ladipro : can your team help to merge it when you feel it is ready. (I don't have permission to do it.)