Closed YuliiaKovalova closed 10 months ago
@baronfel please take a look
Also, can you separate the framework changes into a separate PR? That feels meaningfully distinct.
+1 on a separate PR for the target framework change.
Also, please describe the changes in the initial comment. Ideally everyone would be able to understand how the PR is fixing the issue by reading the description.
Also, can you separate the framework changes into a separate PR? That feels meaningfully distinct.
+1 on a separate PR for the target framework change.
Also, please describe the changes in the initial comment. Ideally everyone would be able to understand how the PR is fixing the issue by reading the description.
I have moved this change to a separate PR: https://github.com/microsoft/MSBuildLocator/pull/231 please take a look.
and the second part of comment is relevant - I will describe my steps in detail.
Fixes: https://github.com/dotnet/msbuild/issues/9038 https://github.com/microsoft/MSBuildLocator/issues/210 https://github.com/microsoft/MSBuildLocator/issues/200 https://github.com/microsoft/MSBuildLocator/issues/181
This PR solves 2 problems:
In order to resolve dotnet path, we probe different sources: Case: MSBuild.Locator is called from dotnet.exe, check DOTNET_ROOT env var -> current process path Case: MSBuild.Locator is called in apphost, check DOTNET_ROOT env var -> DOTNET_HOST_PATH -> DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR -> PATH If the path can't be extracted, an exception is thrown.
When DotnetPath is resolved, we create a subscription on ResolvingUnmanagedDll event when hostfx is requested, if it isn't not loaded in context (the possible reason is described here https://github.com/dotnet/runtime/issues/83774). The path to hostfxr.dylib|so is built based on the pattern/host/fxr//libhostfxr.(dylib|so)