Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: SDK resolving (MSBuildLocator) on Mac with packages installed by Homebrew #9038

Closed
YuliiaKovalova opened this issue Jul 14, 2023 · 3 comments
Assignees

Comments

@YuliiaKovalova
Copy link
Member

YuliiaKovalova commented Jul 14, 2023

Issue Description

Related to microsoft/vscode-dotnettools#194

Prerequisites

Mac OS with Homebrew installed.

Steps To Reproduce

Install the C# Dev Kit
Open a folder with a .csproj file in it.
View error

image

Expected Behavior

SDK is found.

Actual Behavior

SDK is not found

Analysis

No response

Versions & Configurations

No response

@lifengl
Copy link

lifengl commented Aug 22, 2023

Hey, @YuliiaKovalova , @ladipro , based on the net core document https://learn.microsoft.com/en-us/dotnet/core/tutorials/netcore-hosting, the code should call get_hostfxr_path in nethost library to get the path of hostfxr dll, and then understand where to load hostfxr. It looks like the current msbuildLocator has never use nethost, so it really depends on some earlier code path loads it into the memory to work. It might be not the case under certain conditions, and basically, the current implementation has always had a gap here.

and nethost.dll is in any of the NET Core runtime folder, so I assume it is in the searching path and I assume it can be loaded/bound correctly, so if we change the code to do that to resolve where to load hostfxr, it sounds to me the problem can be fixed.

@YuliiaKovalova :, can we get this quickly resolved to address various SDK resolving issue on Mac platform?

@YuliiaKovalova
Copy link
Member Author

YuliiaKovalova commented Aug 22, 2023

Primary sequence of dotnet_path resolution
for non-apphost apps, look for install locations via:
DOTNET_ROOT
dotnet binary that launched us
the known-good default paths

for apphost apps, look for install locations via
DOTNET_ROOT
the known-good default paths
PATH

@YuliiaKovalova
Copy link
Member Author

YuliiaKovalova commented Aug 29, 2023

The fix has been published
https://www.nuget.org/packages/Microsoft.Build.Locator/1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants