提交 b0ec0d50 编写于 作者: S Sam Harwell

Only reset the experimental instance the first time it's launched

This improves the performance of integration tests by reducing the amount of time
it takes to restart a Visual Studio instance.
上级 a6e8f8cf
...@@ -30,6 +30,11 @@ public sealed class VisualStudioInstanceFactory : IDisposable ...@@ -30,6 +30,11 @@ public sealed class VisualStudioInstanceFactory : IDisposable
/// </summary> /// </summary>
private VisualStudioInstance _currentlyRunningInstance; private VisualStudioInstance _currentlyRunningInstance;
/// <summary>
/// Identifies the first time a Visual Studio instance is launched during an integration test run.
/// </summary>
private static bool _firstLaunch = true;
static VisualStudioInstanceFactory() static VisualStudioInstanceFactory()
{ {
var majorVsProductVersion = VsProductVersion.Split('.')[0]; var majorVsProductVersion = VsProductVersion.Split('.')[0];
...@@ -287,11 +292,16 @@ private static Process StartNewVisualStudioProcess(string installationPath) ...@@ -287,11 +292,16 @@ private static Process StartNewVisualStudioProcess(string installationPath)
{ {
var vsExeFile = Path.Combine(installationPath, @"Common7\IDE\devenv.exe"); var vsExeFile = Path.Combine(installationPath, @"Common7\IDE\devenv.exe");
// BUG: Currently building with /p:DeployExtension=true does not always cause the MEF cache to recompose... if (_firstLaunch)
// So, run clearcache and updateconfiguration to workaround https://devdiv.visualstudio.com/DevDiv/_workitems?id=385351. {
Process.Start(vsExeFile, $"/clearcache {VsLaunchArgs}").WaitForExit(); // BUG: Currently building with /p:DeployExtension=true does not always cause the MEF cache to recompose...
Process.Start(vsExeFile, $"/updateconfiguration {VsLaunchArgs}").WaitForExit(); // So, run clearcache and updateconfiguration to workaround https://devdiv.visualstudio.com/DevDiv/_workitems?id=385351.
Process.Start(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}").WaitForExit(); Process.Start(vsExeFile, $"/clearcache {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/updateconfiguration {VsLaunchArgs}").WaitForExit();
Process.Start(vsExeFile, $"/resetsettings General.vssettings /command \"File.Exit\" {VsLaunchArgs}").WaitForExit();
_firstLaunch = false;
}
// Make sure we kill any leftover processes spawned by the host // Make sure we kill any leftover processes spawned by the host
IntegrationHelper.KillProcess("DbgCLR"); IntegrationHelper.KillProcess("DbgCLR");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册