-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Add warning that this isn't how you install .NET Core to run apps. #18715
Comments
What then should we say are the valid use cases for the install scripts? |
I know about one but I think the authors of the script should chime in on it.
|
Who are the authors? |
The scripts originate from here https://github.com/dotnet/install-scripts I think. I created dotnet/install-scripts#43 to get the attention of the right people. |
In my opinion, the valid case to use the scripts is:
There are already many different options for installing the SDK (installers, package managers, containers etc.) which cover a great deal of use cases. We would like to keep scripts separate from those and focus on the main use case: CI. (any disagreements here? @KathleenDollard ) I don't mean "scripts shouldn't set DOTNET_ROOT". Bu putting a warning in the docs and in the script as a first step sounds like a good idea to me. We will track the issue related to the warning printed by the scripts here: dotnet/install-scripts#47 |
User reported confusion using the install scripts to run an app. Tweets are here:
https://twitter.com/zkat__/status/1266151245665861632?s=20
https://twitter.com/zkat__/status/1266432436340092928?s=20
Let's put a comment/warning to use the installers if you want to run .NET Core apps.
I think we just need a simple warning, but I want to preserve @vitek-karas explanation:
dotnet-install: Adding to current process PATH:
Note: This change will not be visible if PowerShell was run as a child process.
What can we do about it:
Detailed explanation of what happens and why when running global tools:
Global tools are always executables, and they were basically the first widely used thing which used executables in .NET Core (before 2.1 we didn’t have the ability to produce executables and everything had to be executed via dotnet.exe).
We made a conscious decision to NOT parse PATH in the .NET Core executable (it’s HARD). So when one runs “dotnet.exe” the PATH resolution is done by the OS/CommandLine, once started dotnet.exe looks at two locations – the place where it is running from and the “global” location.
Application executable can’t look at the place where it’s running from (there’s nothing there, just the app), so it has to rely on something else. That something else is “DOTNET_PATH” environment variable. After that it also looks at “global” location.
“global” location is by default program files.
The dotnet-install.ps1 can set PATH, but it never sets DOTNET_ROOT. I don’t know why. That said regardless of what it does, it would only have effect when running apps after running dotnet-install.ps1 from the same powershell window.
To make the “private” install accessible from anywhere, the user has to add its location to PATH (in user profile or system wide) manually (I assume that’s what you did @kat ?). To make the global tools work the user would have to set DOTNET_ROOT env. variable (in the user profile or system wide).
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The text was updated successfully, but these errors were encountered: