-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Enable building with a dotnet not on PATH #69186
Conversation
In dotnet#68918 we removed inspecting DOTNET_HOST_PATH environment variable. This broke the scenario where a specific dotnet "hive" was installed to a location not on the PATH. When the .NET SDK commands invoke a sub-process (for example MSBuild), it sets the DOTNET_HOST_PATH environment variable to tell the sub-process "this is where the dotnet.exe that invoked this command is located". See dotnet#21237 and dotnet/cli#7311 for more info. This change reverts the behavior back to respect DOTNET_HOST_PATH, and if it isn't set it will just use "dotnet" and let the OS take care of finding the executable on the PATH. Fix dotnet#69150
Thank you! Just ran into this error with rc1 daily build on osx-arm64. The workaround was to symlink the sfx dir like this: # download daily build at ~/.dotnet8 (with `alias dotnet8=~/.dotnet8/dotnet`)
# expect 'dotent8 publish' etc. to work as it's always been..
# (hopefully a temporary) workaround
sudo ln -s ~/.dotnet8/shared/Microsoft.NETCore.App/8.0.0-rc.1.23371.3 /usr/local/share/dotnet/shared/Microsoft.NETCore.App/8.0.0-rc.1.23371.3 |
Before I approve a PR here I think I need a complete explanation of how Additionally, if this is a revert of a prior commit, I would prefer it was actually a revert commit, not a new change. |
|
The problem is that we really don't have one: dotnet/runtime#88754 Adding @agocke for some more context as well. |
I can't speak to the documentation, but this has been the way things work for ~6 years. Multiple places across the product use this mechanism. @marcpopMSFT @dsplaisted @baronfel - is it possible to document this environment variable to address @333fred's concerns? |
@vitek-karas - by "keep things as they are" do you mean as they currently are in dotnet/roslyn |
Sorry for not being clear - I meant the behavior before the break (basically what we shipped in .NET 7). |
Many community tools for making use of the SDK have added this as well - I'm thinking of Buildalyzer and Ionide.ProjInfo here specifically. We should document it as a way to ensure consistency of experience across a single scope/lifetime - often a single
|
@333fred, there were multiple things being changed/fixed in #68918. If we reverted that commit, we would then need to re-open and re-fix the bug it was intended to be fixing - #67102. |
Broader usage of the env variable appears to be somewhat limited: https://github.com/search?q=DOTNET_HOST_PATH++&type=code Doesn't mean we shouldn't support it as an alternative to the path though as it has come up a few times (some customers have requested SDK path be part of global.json to solve this). Seems like an area worth investing in. |
Make the change smaller until @jaredpar gets back. Only make the minimal change required, which is to check DOTNET_HOST_PATH.
In #68918 we removed inspecting DOTNET_HOST_PATH environment variable. This broke the scenario where a specific dotnet "hive" was installed to a location not on the PATH.
When the .NET SDK commands invoke a sub-process (for example MSBuild), it sets the DOTNET_HOST_PATH environment variable to tell the sub-process "this is where the dotnet.exe that invoked this command is located". See #21237 and dotnet/cli#7311 for more info.
This change reverts the behavior back to respect DOTNET_HOST_PATH, and if it isn't set it will just use "dotnet" and let the OS take care of finding the executable on the PATH.
Fix #69150
cc @jaredpar @333fred @ericstj @vitek-karas @dsplaisted