Making a change that will cause the first run notice to always show up in the first run of the CLI, even when it is installed by native installers.

This commit is contained in:
Livar Cunha 2017-07-25 22:30:36 -07:00
parent 5d07534663
commit 20f0dac6b2
7 changed files with 191 additions and 13 deletions

View file

@ -81,8 +81,10 @@ namespace Microsoft.DotNet.Cli
var lastArg = 0;
var cliFallbackFolderPathCalculator = new CliFallbackFolderPathCalculator();
using (INuGetCacheSentinel nugetCacheSentinel = new NuGetCacheSentinel(cliFallbackFolderPathCalculator))
using (IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel = new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator))
using (IFirstTimeUseNoticeSentinel disposableFirstTimeUseNoticeSentinel =
new FirstTimeUseNoticeSentinel(cliFallbackFolderPathCalculator))
{
IFirstTimeUseNoticeSentinel firstTimeUseNoticeSentinel = disposableFirstTimeUseNoticeSentinel;
for (; lastArg < args.Length; lastArg++)
{
if (IsArg(args[lastArg], "d", "diagnostics"))
@ -113,10 +115,19 @@ namespace Microsoft.DotNet.Cli
}
else
{
ConfigureDotNetForFirstTimeUse(nugetCacheSentinel, firstTimeUseNoticeSentinel, cliFallbackFolderPathCalculator);
// It's the command, and we're done!
command = args[lastArg];
if (IsDotnetBeingInvokedFromNativeInstaller(command))
{
firstTimeUseNoticeSentinel = new NoOpFirstTimeUseNoticeSentinel();
}
ConfigureDotNetForFirstTimeUse(
nugetCacheSentinel,
firstTimeUseNoticeSentinel,
cliFallbackFolderPathCalculator);
break;
}
}
@ -164,7 +175,11 @@ namespace Microsoft.DotNet.Cli
}
return exitCode;
}
private static bool IsDotnetBeingInvokedFromNativeInstaller(string command)
{
return command == "internal-reportinstallsuccess";
}
private static void ConfigureDotNetForFirstTimeUse(