From 0237d0c6ddc3456bba2ac24d63265c675c540875 Mon Sep 17 00:00:00 2001 From: Spencer Bloom Date: Tue, 15 Aug 2017 14:55:11 -0700 Subject: [PATCH] add a message popup when project creation fails due to sdk not found (#22) * add a message popup when project creation fails due to sdk not found * use sdk version as string when sdk is pre-win10 --- .../NewProjectWizard/WizardImplementation.cs | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs b/GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs index 98b023f2b..fb1d7d386 100644 --- a/GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs +++ b/GoogleTestAdapter/NewProjectWizard/WizardImplementation.cs @@ -152,21 +152,32 @@ public void RunStarted(object automationObject, if (latestSdk == null) { + MessageBox.Show(Resources.WinSDKNotFound); throw new WizardCancelledException(Resources.WinSDKNotFound); } - List allPlatformsForLatestSdk = ToolLocationHelper.GetPlatformsForSDK("Windows", latestSdk.TargetPlatformVersion) - .Select(moniker => TryParsePlatformVersion(moniker)) - .Where(name => name != null) - .OrderByDescending(p => p.Version).ToList(); - Platform latestPlatform = allPlatformsForLatestSdk.FirstOrDefault(); + string versionString; - if (latestPlatform == null) + if (latestSdk.TargetPlatformVersion.Revision >= 10) { - throw new WizardCancelledException(Resources.WinSDKNotFound); - } + List allPlatformsForLatestSdk = ToolLocationHelper.GetPlatformsForSDK("Windows", latestSdk.TargetPlatformVersion) + .Select(moniker => TryParsePlatformVersion(moniker)) + .Where(name => name != null) + .OrderByDescending(p => p.Version).ToList(); + Platform latestPlatform = allPlatformsForLatestSdk.FirstOrDefault(); + + if (latestPlatform == null) + { + MessageBox.Show(Resources.WinSDKNotFound); + throw new WizardCancelledException(Resources.WinSDKNotFound); + } - string versionString = latestPlatform.Version.ToString(); + versionString = latestPlatform.Version.ToString(); + } + else + { + versionString = latestSdk.TargetPlatformVersion.ToString(); + } replacementsDictionary[TargetPlatformVersion] = versionString; }