[commit] r2555 - trunk/SDK/DotNet/CSharpComponentWizard
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Mon Oct 20 14:46:14 CDT 2014
Author: ksmyth
Date: Mon Oct 20 14:46:14 2014
New Revision: 2555
Log:
VS2013 support in CSharpComponentWizard
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 Mon Oct 20 11:16:26 2014 (r2554)
+++ trunk/SDK/DotNet/CSharpComponentWizard/MainWindow.xaml.cs Mon Oct 20 14:46:14 2014 (r2555)
@@ -18,10 +18,12 @@
// DEFINES
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 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 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}$";
@@ -38,18 +40,34 @@
public MainWindow()
{
- System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
+ System.Type type = null;
+ if (type == null)
+ {
+ type = System.Type.GetTypeFromProgID("VisualStudio.DTE.12.0");
+ }
if (type == null)
{
type = System.Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
}
+ if (type == null)
+ {
+ type = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
+ }
if (type == null || Activator.CreateInstance(type, true) == null)
{
- MessageBox.Show(Assembly.GetExecutingAssembly().GetName().Name + " requires Visual Studio 2010 or 2012 Professional. It cannot work with Visual C# Express.", "", MessageBoxButton.OK, MessageBoxImage.Error);
+ 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);
System.Environment.Exit(11);
}
- RegistryKey masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2012_REGISTRY_KEYPATH);
+ RegistryKey masterKey = null;
+ if (masterKey == null)
+ {
+ masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2013_REGISTRY_KEYPATH);
+ }
+ if (masterKey == null)
+ {
+ masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2012_REGISTRY_KEYPATH);
+ }
if (masterKey == null)
{
masterKey = Registry.CurrentUser.OpenSubKey(MainWindow.VS2010_REGISTRY_KEYPATH);
@@ -735,7 +753,16 @@
string pathToOpen = "\"" + txb_TargetFolder.Text + @"\" + txb_SolutionName.Text + @"\" + txb_SolutionName.Text + ".sln\"";
string DevenvLocation = String.Empty;
- RegistryKey masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2012_REGISTRY_KEYPATH);
+ RegistryKey masterKey = null;
+
+ if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
+ {
+ masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2013_REGISTRY_KEYPATH);
+ }
+ if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
+ {
+ masterKey = Registry.LocalMachine.OpenSubKey(MainWindow.VS2012_REGISTRY_KEYPATH);
+ }
// KMS: on my machine, I had HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\VC\Runtimes\x64 with VS2012 not installed (but no "InstallDir")
if (masterKey == null || masterKey.GetValue(MainWindow.VS_INSTALLDIR_KEYNAME) == null)
Modified: trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs
==============================================================================
--- trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs Mon Oct 20 11:16:26 2014 (r2554)
+++ trunk/SDK/DotNet/CSharpComponentWizard/SolutionGenerator.cs Mon Oct 20 14:46:14 2014 (r2555)
@@ -71,9 +71,16 @@
SolutionGenerator.TemplateFileName = "CSharpInterpreter.zip";
}
- // Prefer VS2012
- System.Type type = System.Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
-
+ // Prefer latest VS
+ System.Type type = null;
+ if (type == null)
+ {
+ type = System.Type.GetTypeFromProgID("VisualStudio.DTE.12.0");
+ }
+ if (type == null)
+ {
+ type = System.Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
+ }
if (type == null)
{
type = System.Type.GetTypeFromProgID("VisualStudio.DTE.10.0");
@@ -295,30 +302,36 @@
public static void GenerateSignature(string outputfolder)
{
// Search sn.exe
- string SNLocation;
+ string SNLocation = null;
using (RegistryKey localMachine = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))
{
- using (RegistryKey masterKey = localMachine.OpenSubKey(MainWindow.MSSDK_REGISTRY_KEYPATH))
+ 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" }
+ })
{
- if (masterKey == null)
- {
- throw new Exception("Cannot locate sn.exe. Is Windows SDK installed?");
- }
- string installationFolder = (string)masterKey.GetValue("InstallationFolder", null);
- if (string.IsNullOrEmpty(installationFolder))
+ using (RegistryKey masterKey = localMachine.OpenSubKey(path.reg))
{
- throw new Exception("Cannot locate sn.exe. Is VS2010 SDK installed?");
- }
- SNLocation = Path.Combine(installationFolder, @"bin\sn.exe");
+ if (masterKey == null)
+ {
+ continue;
+ }
+ string installationFolder = (string)masterKey.GetValue("InstallationFolder", null);
+ string SNCandidate = Path.Combine(installationFolder, path.file);
- if (!File.Exists(SNLocation))
- {
- return; // Assembly won't be signed
- throw new Exception("Cannot locate sn.exe. Is Windows SDK installed?");
+ if (File.Exists(SNCandidate))
+ {
+ SNLocation = SNCandidate;
+ break;
+ }
}
}
}
+ if (string.IsNullOrEmpty(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