Log a verbose message when DOTNET_CLI_HOME is being used.

This commit logs a diagnostic message when the `DOTNET_CLI_HOME` variable is
used.  This enables users to determine where first-run-experience and global
tool files are being written to.

Fixes #9510.
This commit is contained in:
Peter Huene 2018-06-26 16:34:00 -07:00
parent 8cffe4a578
commit 92507184bd
No known key found for this signature in database
GPG key ID: E1D265D820213D6A
16 changed files with 103 additions and 0 deletions

View file

@ -149,6 +149,8 @@ namespace Microsoft.DotNet.Cli
bool skipFirstRunExperience =
environmentProvider.GetEnvironmentVariableAsBool("DOTNET_SKIP_FIRST_TIME_EXPERIENCE", false);
ReportDotnetHomeUsage(environmentProvider);
topLevelCommandParserResult = new TopLevelCommandParserResult(command);
var hasSuperUserAccess = false;
if (IsDotnetBeingInvokedFromNativeInstaller(topLevelCommandParserResult))
@ -229,6 +231,21 @@ namespace Microsoft.DotNet.Cli
return exitCode;
}
private static void ReportDotnetHomeUsage(IEnvironmentProvider provider)
{
var home = provider.GetEnvironmentVariable(CliFolderPathCalculator.DotnetHomeVariableName);
if (string.IsNullOrEmpty(home))
{
return;
}
Reporter.Verbose.WriteLine(
string.Format(
LocalizableStrings.DotnetCliHomeUsed,
home,
CliFolderPathCalculator.DotnetHomeVariableName));
}
private static bool IsDotnetBeingInvokedFromNativeInstaller(TopLevelCommandParserResult parseResult)
{
return parseResult.Command == "internal-reportinstallsuccess";