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

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Aug 25 10:13:28 CDT 2016


Author: ksmyth
Date: Thu Aug 25 10:13:28 2016
New Revision: 2649

Log:
CSharpComponentWizard: VS2015 support

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	Thu Aug 25 10:13:24 2016	(r2648)
+++ trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs	Thu Aug 25 10:13:28 2016	(r2649)
@@ -19,12 +19,13 @@
         public const string VS2010_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\VisualStudio\10.0";
         public const string VS2012_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\VisualStudio\11.0";
         public const string VS2013_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\VisualStudio\12.0";
-        //public const string VS2015_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\VisualStudio\14.0";
+        public const string VS2015_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\VisualStudio\14.0";
         public const string VS_PROJECTFOLDER_REGISTRY_KEYNAME = "VisualStudioProjectsLocation";
         public const string VS_USERPROJECTTEMPLATEPATH_REGISTRY_KEYNAME = "UserProjectTemplatesLocation";
         public const string VS_INSTALLDIR_KEYNAME = "InstallDir";
         public const string MSSDK_REGISTRY_KEYPATH = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A";
         public const string MSSDK_REGISTRY_KEYPATH_8_1A = @"SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A";
+        public const string MSSDK_REGISTRY_KEYPATH_4_6 = @"SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools";
 
         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}$";
 
@@ -43,11 +44,11 @@
         {
             System.Type type = null;
             RegistryKey masterKey = null;
-            //if (type == null)
-            //{
-            //    type = System.Type.GetTypeFromProgID("VisualStudio.DTE.14.0");
-            //    masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2015_REGISTRY_KEYPATH);
-            //}
+            if (type == null)
+            {
+                type = System.Type.GetTypeFromProgID("VisualStudio.DTE.14.0");
+                masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2015_REGISTRY_KEYPATH);
+            }
             if (type == null)
             {
                 type = System.Type.GetTypeFromProgID("VisualStudio.DTE.12.0");
@@ -66,7 +67,7 @@
 
             if (type == null || Activator.CreateInstance(type, true) == null)
             {
-                MessageBox.Show(Assembly.GetExecutingAssembly().GetName().Name + " requires Visual Studio 2010, 2012 or 2013 Professional. It cannot work with Visual C# Express.", "", MessageBoxButton.OK, MessageBoxImage.Error);
+                MessageBox.Show(Assembly.GetExecutingAssembly().GetName().Name + " requires Visual Studio 2010, 2012, 2013, 2015 Professional or Community. It cannot work with Visual C# Express.", "", MessageBoxButton.OK, MessageBoxImage.Error);
                 System.Environment.Exit(11);
             }
 
@@ -751,10 +752,10 @@
 
                 string DevenvLocation = String.Empty;
                 RegistryKey masterKey = null;
-                //if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
-                //{
-                //    masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2015_REGISTRY_KEYPATH);
-                //}
+                if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
+                {
+                    masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2015_REGISTRY_KEYPATH);
+                }
                 if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
                 {
                     masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2013_REGISTRY_KEYPATH);

Modified: trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs
==============================================================================
--- trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs	Thu Aug 25 10:13:24 2016	(r2648)
+++ trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs	Thu Aug 25 10:13:28 2016	(r2649)
@@ -33,10 +33,10 @@
     public static class SolutionGenerator
     {
         public const string ENTRYPOINTCODE_REPLACESTRING = "$GET_ROOTFOLDER_CODE$";
-        
+
         public static MainWindow mw;
         public static Dictionary<int, string> AddonEvents;
-        
+
         public static CompType SelectedType = CompType.Interpreter;
         public static ComponentInterface SelectedInterface = ComponentInterface.Dependent;
         public static Registration SelectedRegistration = Registration.Systemwide;
@@ -53,7 +53,7 @@
         public static string ProjectTemplateLocation;
         public static string TemplateFileName;
 
-      
+
         public static string GenerateSolution()
         {
             DTE2 dte;
@@ -75,6 +75,10 @@
                 System.Type type = null;
                 if (type == null)
                 {
+                    type = System.Type.GetTypeFromProgID("VisualStudio.DTE.14.0");
+                }
+                if (type == null)
+                {
                     type = System.Type.GetTypeFromProgID("VisualStudio.DTE.12.0");
                 }
                 if (type == null)
@@ -154,7 +158,7 @@
                 // Set EventMask
                 StringBuilder eventmask = new StringBuilder();
                 bool firsttime = true;
-             
+
                 for (int i = 0; i <= 24; ++i)
                 {
                     if (SolutionGenerator.AddonEventSelection[i])
@@ -296,7 +300,7 @@
                 FileWriteStream = new StreamWriter(Path.Combine(outputfolder, "" + SolutionName + ".csproj"));
                 FileWriteStream.Write(ContentString);
                 FileWriteStream.Close();
-            }           
+            }
         }
 
         public static void GenerateSignature(string outputfolder)
@@ -304,12 +308,14 @@
             // Search sn.exe
             string SNLocation = null;
 
-            using (RegistryKey localMachine = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
-            {
-                foreach (var path in new [] {
-                    new {reg= MainWindow.MSSDK_REGISTRY_KEYPATH_8_1A, file= "bin\\NETFX 4.5.1 Tools\\sn.exe" },
-                    new {reg= MainWindow.MSSDK_REGISTRY_KEYPATH, file="bin\\sn.exe" }
+            foreach (var path in new[] {
+                    new {reg= @"SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.6.1\WinSDK-NetFx40Tools", file="bin\\sn.exe", view= RegistryView.Registry32 },
+                    new {reg= @"SOFTWARE\Microsoft\Microsoft SDKs\NETFXSDK\4.6\WinSDK-NetFx40Tools", file="bin\\sn.exe", view= RegistryView.Registry32 },
+                    new {reg= MainWindow.MSSDK_REGISTRY_KEYPATH_8_1A, file= "bin\\NETFX 4.5.1 Tools\\sn.exe", view= RegistryView.Registry64 },
+                    new {reg= MainWindow.MSSDK_REGISTRY_KEYPATH, file="bin\\sn.exe", view= RegistryView.Registry64 }
                 })
+            {
+                using (RegistryKey localMachine = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, path.view))
                 {
                     using (RegistryKey masterKey = localMachine.OpenSubKey(path.reg))
                     {
@@ -353,8 +359,8 @@
                 {
                     throw new Exception("Error occured during the domain specific interface generation.");
                 }
-            } 
-            catch(Exception)
+            }
+            catch (Exception)
             {
                 object[] args = new object[1];
                 args[0] = GeneratorFacade.Errors;
@@ -364,7 +370,7 @@
                 }
                 throw;
             }
-                    
+
             // Add files to the projectfile
             string AddString = String.Empty;
             foreach (string s in GeneratorFacade.generatedFiles)
@@ -393,12 +399,12 @@
                 MessageBox.Show("Error occured: Cannot find the previously generated VS projectfile in the specified folder with the specified solutionname.");
                 throw;
             }
-            
+
         }
 
         public static string AddEntryPointCode(string ContentString)
         {
-            if(SolutionGenerator.SelectedInterface == ComponentInterface.Dependent)
+            if (SolutionGenerator.SelectedInterface == ComponentInterface.Dependent)
             {
                 string getrootfolder_domain_specific = @"RootFolder rf = new RootFolder(project.RootFolder);";
                 getrootfolder_domain_specific += Environment.NewLine + "\t\t\t";
@@ -417,6 +423,6 @@
 
             return ContentString;
         }
-    
+
     }
 }


More information about the gme-commit mailing list