Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,20 @@ private static Process StartNewVisualStudioProcess(string installationPath, int
if (majorVersion == 16)
{
// Make sure the start window doesn't show on launch
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU General OnEnvironmentStartup dword 10").WaitForExit();
Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU General OnEnvironmentStartup dword 10")).WaitForExit();
}

// BUG: Currently building with /p:DeployExtension=true does not always cause the MEF cache to recompose...
// So, run clearcache and updateconfiguration to workaround https://devdiv.visualstudio.com/DevDiv/_workitems?id=385351.
Process.Start(vsExeFile, $"/clearcache {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/updateconfiguration {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}").WaitForExit();
Process.Start(CreateSilentStartInfo(vsExeFile, $"/clearcache {VsLaunchArgs}")).WaitForExit();
Process.Start(CreateSilentStartInfo(vsExeFile, $"/updateconfiguration {VsLaunchArgs}")).WaitForExit();
Process.Start(CreateSilentStartInfo(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}")).WaitForExit();

// Disable roaming settings to avoid interference from the online user profile
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\Microsoft\\VisualStudio\" RoamingEnabled string \"1*System.Boolean*False\"").WaitForExit();
Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\Microsoft\\VisualStudio\" RoamingEnabled string \"1*System.Boolean*False\"")).WaitForExit();

// Disable background download UI to avoid toasts
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"FeatureFlags\\Setup\\BackgroundDownload\" Value dword 0").WaitForExit();
Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"FeatureFlags\\Setup\\BackgroundDownload\" Value dword 0")).WaitForExit();

// Remove legacy experiment setting for controlling async completion to ensure it does not interfere.
// We no longer set this value, but it could be in place from an earlier test run on the same machine.
Expand All @@ -341,7 +341,7 @@ private static Process StartNewVisualStudioProcess(string installationPath, int

// Disable text editor error reporting because it pops up a dialog. We want to either fail fast in our
// custom handler or fail silently and continue testing.
Process.Start(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"Text Editor\" \"Report Exceptions\" dword 0").WaitForExit();
Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"Text Editor\" \"Report Exceptions\" dword 0")).WaitForExit();

_firstLaunch = false;
}
Expand All @@ -355,6 +355,11 @@ private static Process StartNewVisualStudioProcess(string installationPath, int
Debug.WriteLine($"Launched a new instance of Visual Studio. (ID: {process.Id})");

return process;

static ProcessStartInfo CreateSilentStartInfo(string fileName, string arguments)
{
return new ProcessStartInfo(fileName, arguments) { CreateNoWindow = true, UseShellExecute = false };
}
}

private static string GetAssemblyDirectory()
Expand Down