Fix failure to add tools path on restricted Windows environments.

On environments where registry access is disabled, the first run experience
fails because it could not add the tools path to the user's environment.

This fix properly handles the security exception by printing a warning and
continuing.  Users will have to manually add the PATH environment variable to
their environments to prevent `dotnet tool install` from printing PATH
instructions.

A new file sentinel is added to track whether or not the PATH has been
modified.  The first run experience also now correctly skips modifying the PATH
if `DOTNET_SKIP_FIRST_TIME_EXPERIENCE` is set.

Fixes #8874.
This commit is contained in:
Peter Huene 2018-03-23 12:40:58 -07:00
parent d3f69e2e01
commit 19090744cb
No known key found for this signature in database
GPG key ID: E1D265D820213D6A
31 changed files with 746 additions and 328 deletions

View file

@ -878,6 +878,11 @@ setx PATH "%PATH%;{0}"
<target state="new">Format version is missing. This tool may not be supported in this SDK version. Please contact the author of the tool.</target>
<note />
</trans-unit>
<trans-unit id="FailedToSetToolsPathEnvironmentVariable">
<source>Failed to add '{0}' to the PATH environment variable. Please add this directory to your PATH to use tools installed with 'dotnet tool install'.</source>
<target state="new">Failed to add '{0}' to the PATH environment variable. Please add this directory to your PATH to use tools installed with 'dotnet tool install'.</target>
<note />
</trans-unit>
</body>
</file>
</xliff>