Closed YuliiaKovalova closed 11 months ago
@ladipro , @rainersigwald is it ok that we have started to generate this folder in output?
runtime content
How will it be shipped?
@YuliiaKovalova this looks expected, the native libraries should not be taking too much extra space.
How will it be shipped?
It should become part of the Microsoft.Build.Locator package.
Also, is it possible to cover the P/Invoke with a test? Something that would have previously failed on Mac or Linux.
Actually, it should still be failing because we're currently not making the call to nethost!get_hostfxr_path
. Or are the current changes enough to fix the issue? I hope I'm not misunderstanding the changes.
Also, is it possible to cover the P/Invoke with a test? Something that would have previously failed on Mac or Linux.
Actually, it should still be failing because we're currently not making the call to
nethost!get_hostfxr_path
. Or are the current changes enough to fix the issue? I hope I'm not misunderstanding the changes.
It works as expected now because the source issue with the missed lib is resolved. Previously, it was failing here https://github.com/YuliiaKovalova/MSBuildLocator/blob/a7e81c92e079900d3403e71542c59d6cc767daaf/src/MSBuildLocator/DotNetSdkLocationHelper.cs#L116C36-L116C56 with
07/17/2023 15:48:47 Greenwich Mean Time: Error : 9543 :!!Resolve NET Core SDK: Failed System.DllNotFoundException: Unable to load shared library 'hostfxr' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/hostfxr.dylib, 1): image not found dlopen(/Users/timjroberts/.vscode/extensions/ms-dotnettools.csdevkit-0.2.100-darwin-x64/components/CPS/platforms/darwin-x64/node_modules/@microsoft/visualstudio-projectsystem-buildhost.darwin-x64/hostfxr.dylib, 1): image not found dlopen(hostfxr.dylib, 1): image not found dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libhostfxr.dylib, 1): image not found dlopen(/Users/timjroberts/.vscode/extensions/ms-dotnettools.csdevkit-0.2.100-darwin-x64/components/CPS/platforms/darwin-x64/node_modules/@microsoft/visualstudio-projectsystem-buildhost.darwin-x64/libhostfxr.dylib, 1): image not found dlopen(libhostfxr.dylib, 1): image not found dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/hostfxr, 1): image not found dlopen(/Users/timjroberts/.vscode/extensions/ms-dotnettools.csdevkit-0.2.100-darwin-x64/components/CPS/platforms/darwin-x64/node_modules/@microsoft/visualstudio-projectsystem-buildhost.darwin-x64/hostfxr, 1): image not found dlopen(hostfxr, 1): image not found dlopen(/usr/local/share/dotnet/shared/Microsoft.NETCore.App/7.0.9/libhostfxr, 1): image not found dlopen(/Users/timjroberts/.vscode/extensions/ms-dotnettools.csdevkit-0.2.100-darwin-x64/components/CPS/platforms/darwin-x64/node_modules/@microsoft/visualstudio-projectsystem-buildhost.darwin-x64/libhostfxr, 1): image not found dlopen(libhostfxr, 1): image not found
There is no need to request the path.
That's odd, it looks like we're not even loading the nethost
library so it's not clear how it makes the call to hostfxr
succeed 🤔
Problem
Fixes: #https://github.com/dotnet/msbuild/issues/9038
MSBuildLocator expects that hostfxr lib is already loaded in the process - that is true for Windows load library, but not for all platforms (macOS, for example). Some of our customers face an issue like:
Solution
Microsoft.NETCore.DotNetAppHost is a metadata package that loads a platform-specific assembly in runtime. Specifying reference to it explicitly
<PackageReference Include="runtime.$(RuntimeIdentifier).Microsoft.NETCore.DotNetAppHost" Version="7.0.9" />
helps to copy the content in project/bin folder , so missed library can be resolved.