[commit] r2164 - trunk/SDK/DotNet/CSharpComponentWizard

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Mar 22 10:24:25 CDT 2013


Author: ksmyth
Date: Fri Mar 22 10:24:25 2013
New Revision: 2164

Log:
Fix finding SN.exe if e.g. WinSDK 7.0 is installed after VS2010

Modified:
   trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs
   trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs

Modified: trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs
==============================================================================
--- trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs	Fri Mar 22 10:23:57 2013	(r2163)
+++ trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs	Fri Mar 22 10:24:25 2013	(r2164)
@@ -19,8 +19,7 @@
         public const string VS2010_PROJECTFOLDER_REGISTRY_KEYNAME = "VisualStudioProjectsLocation";
         public const string VS2010_USERPROJECTTEMPLATEPATH_REGISTRY_KEYNAME = "UserProjectTemplatesLocation";
         public const string VS2010_INSTALLDIR_KEYNAME = "InstallDir";
-        public const string MSSDK_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows";
-        public const string MSSDK_INSTALLFOLDER_REGISTRY_KEYNAME = "CurrentInstallFolder";
+        public const string MSSDK_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A";
 
         public const string GUIDREGEXP = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$";
 

Modified: trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs
==============================================================================
--- trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs	Fri Mar 22 10:23:57 2013	(r2163)
+++ trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs	Fri Mar 22 10:24:25 2013	(r2164)
@@ -236,7 +236,7 @@
                 ContentString = ContentString.Replace("MyAddon", SolutionName);
 
                 StreamWriter ComponentConfigWriteStream = new StreamWriter(Path.Combine(outputfolder, "MyAddon.cs"));
-                 ComponentConfigWriteStream.Write(ContentString);
+                ComponentConfigWriteStream.Write(ContentString);
                 ComponentConfigWriteStream.Close();
 
                 File.Move(Path.Combine(outputfolder, "MyAddon.cs"), Path.Combine(outputfolder, SolutionName + ".cs"));
@@ -296,18 +296,24 @@
         {
             // Search sn.exe
             string SNLocation;
-            RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.MSSDK_REGISTRY_KEYPATH);
-            if (masterKey == null)
-            {
-                throw new Exception("Cannot locate sn.exe. Is VS2010 SDK installed?");
-            }
-            else
+            using (RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.MSSDK_REGISTRY_KEYPATH))
             {
-                SNLocation = masterKey.GetValue(MainWindow.MSSDK_INSTALLFOLDER_REGISTRY_KEYNAME).ToString();
-            }
-            masterKey.Close();
+                if (masterKey == null)
+                {
+                    throw new Exception("Cannot locate sn.exe. Is VS2010 SDK installed?");
+                }
+                string installationFolder = (string)masterKey.GetValue("InstallationFolder", null);
+                if (string.IsNullOrEmpty(installationFolder))
+                {
+                    throw new Exception("Cannot locate sn.exe. Is VS2010 SDK installed?");
+                }
+                SNLocation = Path.Combine(installationFolder, @"bin\sn.exe");
 
-            SNLocation += @"\bin\sn.exe";
+                if (!File.Exists(SNLocation))
+                {
+                    throw new Exception("Cannot locate sn.exe. Is VS2010 SDK installed?");
+                }
+            }
 
             System.Diagnostics.ProcessStartInfo pinfo = new System.Diagnostics.ProcessStartInfo();
             pinfo.Arguments = "-k \"" + outputfolder + "\\AssemblySignature.snk\"";


More information about the gme-commit mailing list