public void GatherExtensionSDKsInvalidVersionDirectory() { string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); string sdkDirectory = Path.Combine(tempDirectory, @"Foo\Bar"); try { Directory.CreateDirectory(sdkDirectory); DirectoryInfo info = new DirectoryInfo(tempDirectory); TargetPlatformSDK sdk = new TargetPlatformSDK("Foo", new Version(), String.Empty); ToolLocationHelper.GatherExtensionSDKs(info, sdk); Assert.AreEqual(0, sdk.ExtensionSDKs.Count); } finally { if (Directory.Exists(tempDirectory)) { Directory.Delete(tempDirectory, true); } } }
public void GetALLTargetPlatformSDKs() { try { Environment.SetEnvironmentVariable("MSBUILDDISABLEREGISTRYFORSDKLOOKUP", "true"); var sdks = ToolLocationHelper.GetTargetPlatformSdks(new string[] { _fakeStructureRoot }, null); Dictionary<TargetPlatformSDK, TargetPlatformSDK> targetPlatforms = new Dictionary<TargetPlatformSDK, TargetPlatformSDK>(); foreach (TargetPlatformSDK sdk in sdks) { targetPlatforms.Add(sdk, sdk); } TargetPlatformSDK key = new TargetPlatformSDK("Windows", new Version("1.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("Windows", new Version("2.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\2.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("3.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\3.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("2.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\2.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("1.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("5.0"), null); Assert.False(targetPlatforms.ContainsKey(key)); } finally { Environment.SetEnvironmentVariable("MSBUILDDISABLEREGISTRYFORSDKLOOKUP", null); } }
public void ResolveSDKFromRegistryAndDisk() { Dictionary<TargetPlatformSDK, TargetPlatformSDK> targetPlatforms = new Dictionary<TargetPlatformSDK, TargetPlatformSDK>(); List<string> paths = new List<string>() { _fakeStructureRoot }; ToolLocationHelper.GatherSDKListFromDirectory(paths, targetPlatforms); ToolLocationHelper.GatherSDKsFromRegistryImpl(targetPlatforms, "Software\\Microsoft\\MicrosoftSDks", RegistryView.Registry32, RegistryHive.CurrentUser, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, _openBaseKey, new FileExists(File.Exists)); ToolLocationHelper.GatherSDKsFromRegistryImpl(targetPlatforms, "Software\\Microsoft\\MicrosoftSDks", RegistryView.Registry32, RegistryHive.LocalMachine, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, _openBaseKey, new FileExists(File.Exists)); TargetPlatformSDK key = new TargetPlatformSDK("Windows", new Version("1.0"), null); Assert.Equal(2, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\v1.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=2.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=2.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\1.0\\ExtensionSDKs\\MyAssembly\\2.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("Windows", new Version("2.0"), null); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\2.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=3.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=3.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\2.0\\ExtensionSDKs\\MyAssembly\\3.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("6.0"), null); Assert.True(targetPlatforms.ContainsKey(key)); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows Kits\\6.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("5.0"), null); Assert.True(targetPlatforms.ContainsKey(key)); Assert.Equal(0, targetPlatforms[key].ExtensionSDKs.Count); Assert.Null(targetPlatforms[key].Path); key = new TargetPlatformSDK("MyPlatform", new Version("4.0"), null); Assert.Equal(2, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "SomeOtherPlace\\MyPlatformOtherLocation\\4.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "SomeOtherPlace\\MyPlatformOtherLocation\\4.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("AnotherAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["AnotherAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\4.0\\ExtensionSDKs\\AnotherAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("3.0"), null); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\3.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\3.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("2.0"), null); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\2.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\2.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("1.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.Equal(0, targetPlatforms[key].ExtensionSDKs.Count); }
public void ResolveSDKFromDirectory() { Dictionary<string, string> extensionSDKs = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); List<string> paths = new List<string> { _fakeStructureRoot, _fakeStructureRoot2 }; Dictionary<TargetPlatformSDK, TargetPlatformSDK> targetPlatforms = new Dictionary<TargetPlatformSDK, TargetPlatformSDK>(); ToolLocationHelper.GatherSDKListFromDirectory(paths, targetPlatforms); TargetPlatformSDK key = new TargetPlatformSDK("Windows", new Version("1.0"), null); Assert.Equal(2, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\v1.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=2.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=2.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\1.0\\ExtensionSDKs\\MyAssembly\\2.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("Windows", new Version("2.0"), null); Assert.Equal(2, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "Windows\\2.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=3.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=3.0"].Equals(Path.Combine(_fakeStructureRoot, "Windows\\2.0\\ExtensionSDKs\\MyAssembly\\3.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=4.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=4.0"].Equals(Path.Combine(_fakeStructureRoot2, "Windows\\2.0\\ExtensionSDKs\\MyAssembly\\4.0\\"), StringComparison.OrdinalIgnoreCase)); // Windows kits special case is only in registry key = new TargetPlatformSDK("MyPlatform", new Version("6.0"), null); Assert.False(targetPlatforms.ContainsKey(key)); key = new TargetPlatformSDK("MyPlatform", new Version("4.0"), null); Assert.Null(targetPlatforms[key].Path); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("AnotherAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["AnotherAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\4.0\\ExtensionSDKs\\AnotherAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("3.0"), null); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\3.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\3.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("2.0"), null); Assert.Equal(1, targetPlatforms[key].ExtensionSDKs.Count); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\2.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.True(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.True(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\2.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("1.0"), null); Assert.True(targetPlatforms[key].Path.Equals(Path.Combine(_fakeStructureRoot, "MyPlatform\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.Equal(0, targetPlatforms[key].ExtensionSDKs.Count); key = new TargetPlatformSDK("MyPlatform", new Version("8.0"), null); Assert.Equal(Path.Combine(_fakeStructureRoot, "MyPlatform\\8.0\\"), targetPlatforms[key].Path); Assert.Equal(0, targetPlatforms[key].ExtensionSDKs.Count); Assert.Equal(3, targetPlatforms[key].Platforms.Count); Assert.True(targetPlatforms[key].ContainsPlatform("PlatformAssembly", "0.1.2.3")); Assert.Equal(Path.Combine(_fakeStructureRoot, "MyPlatform\\8.0\\Platforms\\PlatformAssembly\\0.1.2.3\\"), targetPlatforms[key].Platforms["PlatformAssembly, Version=0.1.2.3"]); Assert.True(targetPlatforms[key].ContainsPlatform("PlatformAssembly", "1.2.3.0")); Assert.True(targetPlatforms[key].ContainsPlatform("Sparkle", "3.3.3.3")); key = new TargetPlatformSDK("MyPlatform", new Version("9.0"), null); Assert.Equal(Path.Combine(_fakeStructureRoot, "MyPlatform\\9.0\\"), targetPlatforms[key].Path); Assert.Equal(0, targetPlatforms[key].ExtensionSDKs.Count); Assert.Equal(1, targetPlatforms[key].Platforms.Count); Assert.True(targetPlatforms[key].ContainsPlatform("PlatformAssembly", "0.1.2.3")); Assert.Equal(Path.Combine(_fakeStructureRoot, "MyPlatform\\9.0\\Platforms\\PlatformAssembly\\0.1.2.3\\"), targetPlatforms[key].Platforms["PlatformAssembly, Version=0.1.2.3"]); }
public void GatherExtensionSDKsGarbageManifest() { string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); string sdkDirectory = Path.Combine(tempDirectory, @"Foo\1.0"); try { Directory.CreateDirectory(sdkDirectory); File.WriteAllText(Path.Combine(sdkDirectory, "sdkManifest.xml"), "Garbaggggge"); DirectoryInfo info = new DirectoryInfo(tempDirectory); TargetPlatformSDK sdk = new TargetPlatformSDK("Foo", new Version(), String.Empty); ToolLocationHelper.GatherExtensionSDKs(info, sdk); Assert.Equal(1, sdk.ExtensionSDKs.Count); } finally { if (Directory.Exists(tempDirectory)) { Directory.Delete(tempDirectory, true); } } }
public void ResolveSDKFromRegistry() { Dictionary<TargetPlatformSDK, TargetPlatformSDK> targetPlatforms = new Dictionary<TargetPlatformSDK, TargetPlatformSDK>(); ToolLocationHelper.GatherSDKsFromRegistryImpl(targetPlatforms, "Software\\Microsoft\\MicrosoftSDks", RegistryView.Registry32, RegistryHive.CurrentUser, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, s_openBaseKey, new FileExists(File.Exists)); ToolLocationHelper.GatherSDKsFromRegistryImpl(targetPlatforms, "Software\\Microsoft\\MicrosoftSDks", RegistryView.Registry32, RegistryHive.LocalMachine, getRegistrySubKeyNames, getRegistrySubKeyDefaultValue, s_openBaseKey, new FileExists(File.Exists)); TargetPlatformSDK key = new TargetPlatformSDK("Windows", new Version("1.0"), null); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.Count == 2); Assert.IsTrue(targetPlatforms[key].Path.Equals(Path.Combine(s_fakeStructureRoot, "Windows\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(s_fakeStructureRoot, "Windows\\v1.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=2.0")); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=2.0"].Equals(Path.Combine(s_fakeStructureRoot, "Windows\\1.0\\ExtensionSDKs\\MyAssembly\\2.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("Windows", new Version("2.0"), null); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.Count == 1); Assert.IsTrue(targetPlatforms[key].Path.Equals(Path.Combine(s_fakeStructureRoot, "Windows\\2.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=3.0")); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=3.0"].Equals(Path.Combine(s_fakeStructureRoot, "Windows\\2.0\\ExtensionSDKs\\MyAssembly\\3.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("5.0"), null); Assert.IsTrue(targetPlatforms.ContainsKey(key)); Assert.IsTrue(targetPlatforms[key].Path == null); key = new TargetPlatformSDK("MyPlatform", new Version("6.0"), null); Assert.IsTrue(targetPlatforms.ContainsKey(key)); Assert.IsTrue(targetPlatforms[key].Path.Equals(Path.Combine(s_fakeStructureRoot, "Windows Kits\\6.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("4.0"), null); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.Count == 1); Assert.IsTrue(targetPlatforms[key].Path.Equals(Path.Combine(s_fakeStructureRoot, "SomeOtherPlace\\MyPlatformOtherLocation\\4.0\\"), StringComparison.OrdinalIgnoreCase)); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs.ContainsKey("MyAssembly, Version=1.0")); Assert.IsTrue(targetPlatforms[key].ExtensionSDKs["MyAssembly, Version=1.0"].Equals(Path.Combine(s_fakeStructureRoot, "SomeOtherPlace\\MyPlatformOtherLocation\\4.0\\ExtensionSDKs\\MyAssembly\\1.0\\"), StringComparison.OrdinalIgnoreCase)); key = new TargetPlatformSDK("MyPlatform", new Version("9.0"), null); Assert.AreEqual(Path.Combine(s_fakeStructureRoot, "MyPlatform\\9.0\\"), targetPlatforms[key].Path); Assert.AreEqual(0, targetPlatforms[key].ExtensionSDKs.Count); Assert.AreEqual(1, targetPlatforms[key].Platforms.Count); Assert.IsTrue(targetPlatforms[key].ContainsPlatform("PlatformAssembly", "0.1.2.3")); Assert.AreEqual(Path.Combine(s_fakeStructureRoot, "MyPlatform\\9.0\\Platforms\\PlatformAssembly\\0.1.2.3\\"), targetPlatforms[key].Platforms["PlatformAssembly, Version=0.1.2.3"]); }
public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { DTE dte = (DTE)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SDTE)); Projects dteProjects = dte.Solution.Projects; List <string> projectNames = new List <string>(); bool isPlatformSet = false; foreach (Project project in dteProjects) { // TODO: Filter out projects not applicable projects.Add(project); projectNames.Add(project.Name); } ConfigurationData configurationData = new ConfigurationData(dte, projectNames.ToArray()); SinglePageWizardDialog wiz = new SinglePageWizardDialog(Resources.WizardTitle, configurationData); bool?success = false; // If RunSilent is true, we're in automated testing if (replacementsDictionary[RunSilent] == "True") { success = true; SetDefaultData(ref configurationData); } else { success = wiz.ShowModal(); } if (success == false) { throw new WizardCancelledException(); } selectedProjectIndex = configurationData.ProjectIndex; if (selectedProjectIndex >= 0) { foreach (Property prop in projects[selectedProjectIndex].Properties) { if (prop.Name.Equals("WindowsTargetPlatformVersion")) { replacementsDictionary[TargetPlatformVersion] = (string)prop.Value; isPlatformSet = true; } } } string consumeGTestAs = configurationData.IsGTestStatic ? "static" : "dyn"; string runtimeLibs = configurationData.IsRuntimeStatic ? "static" : "dyn"; string nugetPackage = "Microsoft.googletest.v140.windesktop.msvcstl." + consumeGTestAs + ".rt-" + runtimeLibs; // Work around so we can choose the package for the nuget wizard string tmpWizardData = Path.GetTempFileName(); File.AppendAllText(tmpWizardData, "<VSTemplate Version=\"3.0.0\" xmlns=\"http://schemas.microsoft.com/developer/vstemplate/2005\" Type=\"Project\"><WizardData>"); File.AppendAllText(tmpWizardData, replacementsDictionary[WizardData].Replace("$nugetpackage$", nugetPackage)); File.AppendAllText(tmpWizardData, "</WizardData></VSTemplate>"); customParams[0] = tmpWizardData; try { Assembly nugetAssembly = Assembly.Load("NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); nugetWizard = (IWizard)nugetAssembly.CreateInstance("NuGet.VisualStudio.TemplateWizard"); nugetWizard.RunStarted(automationObject, replacementsDictionary, runKind, customParams); } catch (Exception) { ShowRtlAwareMessageBox(Resources.NuGetInteropNotFound); throw; } if (configurationData.IsRuntimeStatic) { replacementsDictionary[RuntimeRelease] = "MultiThreaded"; replacementsDictionary[RuntimeDebug] = "MultiThreadedDebug"; } else { replacementsDictionary[RuntimeRelease] = "MultiThreadedDLL"; replacementsDictionary[RuntimeDebug] = "MultiThreadedDebugDLL"; } if (!isPlatformSet) { IEnumerable <TargetPlatformSDK> platformSdks = ToolLocationHelper.GetTargetPlatformSdks(); IEnumerable <TargetPlatformSDK> allSdks = WizardImplementation.GetAllPlatformSdks(); TargetPlatformSDK latestSdk = allSdks.FirstOrDefault(); if (latestSdk == null) { ShowRtlAwareMessageBox(Resources.WinSDKNotFound); throw new WizardCancelledException(Resources.WinSDKNotFound); } string versionString; if (latestSdk.TargetPlatformVersion.Major >= 10) { List <Platform> 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) { ShowRtlAwareMessageBox(Resources.WinSDKNotFound); throw new WizardCancelledException(Resources.WinSDKNotFound); } versionString = latestPlatform.Version.ToString(); } else { versionString = latestSdk.TargetPlatformVersion.ToString(); } replacementsDictionary[TargetPlatformVersion] = versionString; } }