From 73a53c4c8d965fa0c323b7a850f30dd12fa7cfc3 Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Sun, 27 Aug 2017 03:30:21 +1000 Subject: [PATCH] Don't use legacy pre-VS2017 logic if we successfully launched VS via vswhere This second block needed to be guarded so that we don't accidentally launch two instances of Visual Studio. --- .../IDEControl/VisualStudioIDEControl.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Protobuild.Manager/IDEControl/VisualStudioIDEControl.cs b/Protobuild.Manager/IDEControl/VisualStudioIDEControl.cs index 2ff4352..1e8b312 100644 --- a/Protobuild.Manager/IDEControl/VisualStudioIDEControl.cs +++ b/Protobuild.Manager/IDEControl/VisualStudioIDEControl.cs @@ -415,18 +415,21 @@ private async Task LaunchVisualStudio(string modulePath, string moduleN } } - var versions = new[] {"14.0", "12.0", "11.0", "10.0"}; - foreach (var version in versions) + if (!started) { - var idePath = @"C:\Program Files (x86)\Microsoft Visual Studio " + version + - @"\Common7\IDE\devenv.exe"; - if (File.Exists(idePath)) + var versions = new[] {"14.0", "12.0", "11.0", "10.0"}; + foreach (var version in versions) { - Process.Start( - idePath, - "\"" + Path.Combine(modulePath, moduleName + "." + targetPlatform + ".sln") + "\""); - started = true; - break; + var idePath = @"C:\Program Files (x86)\Microsoft Visual Studio " + version + + @"\Common7\IDE\devenv.exe"; + if (File.Exists(idePath)) + { + Process.Start( + idePath, + "\"" + Path.Combine(modulePath, moduleName + "." + targetPlatform + ".sln") + "\""); + started = true; + break; + } } }