forked from CosmosOS/Cosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability to run builder for VS2015 and VS2013
- Loading branch information
Showing
5 changed files
with
139 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.IO; | ||
using Microsoft.Win32; | ||
namespace Cosmos.Build.Installer { | ||
public static class Paths { | ||
static Paths() { | ||
if (Global.IsX64) { | ||
ProgFiles32 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); | ||
ProgFiles64 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); | ||
} else { | ||
ProgFiles32 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); | ||
} | ||
// The Install Dir will pickup only the Visual Studio 2013 path currently. | ||
RegistryKey key = Registry.LocalMachine.OpenSubKey(string.Format(@"SOFTWARE{0}\microsoft\VisualStudio\12.0", | ||
Environment.Is64BitOperatingSystem ? @"\Wow6432Node" : "")); | ||
VSInstall = key.GetValue("InstallDir") as string; | ||
Windows = Environment.GetFolderPath(Environment.SpecialFolder.Windows); | ||
|
||
namespace Cosmos.Build.Installer | ||
{ | ||
public static class Paths | ||
{ | ||
/// <summary> | ||
/// Version of Visual Studio for which paths should be detected. | ||
/// </summary> | ||
private static VsVersion vsVersion; | ||
|
||
public static readonly string ProgFiles32; | ||
public static readonly string ProgFiles64; | ||
public static readonly string Windows; | ||
|
||
static Paths() | ||
{ | ||
if (Global.IsX64) | ||
{ | ||
ProgFiles32 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); | ||
ProgFiles64 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); | ||
} | ||
else | ||
{ | ||
ProgFiles32 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); | ||
} | ||
|
||
UpdateVsPath(); | ||
Windows = Environment.GetFolderPath(Environment.SpecialFolder.Windows); | ||
} | ||
|
||
/// <summary> | ||
/// Gets path where Visual Studio installed | ||
/// </summary> | ||
public static string VSInstall { get; private set; } | ||
|
||
/// <summary> | ||
/// Version of Visual Studio for which paths should be detected. | ||
/// </summary> | ||
public static VsVersion VsVersion | ||
{ | ||
get { return vsVersion; } | ||
|
||
set | ||
{ | ||
vsVersion = value; | ||
UpdateVsPath(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Updates path to VS version | ||
/// </summary> | ||
private static void UpdateVsPath() | ||
{ | ||
// The Install Dir will pickup only the Visual Studio 2013/2015 path currently. | ||
RegistryKey key; | ||
string vsVersionCode; | ||
switch (VsVersion) | ||
{ | ||
case VsVersion.Vs2013: | ||
vsVersionCode = "12.0"; | ||
break; | ||
case VsVersion.Vs2015: | ||
vsVersionCode = "14.0"; | ||
break; | ||
default: | ||
throw new NotSupportedException("Versions of VS other then 2013 and 2015 not supported."); | ||
} | ||
|
||
var registryKey = string.Format( | ||
@"SOFTWARE{0}\microsoft\VisualStudio\{1}", | ||
Environment.Is64BitOperatingSystem ? @"\Wow6432Node" : "", | ||
vsVersionCode); | ||
key = Registry.LocalMachine.OpenSubKey(registryKey); | ||
VSInstall = key.GetValue("InstallDir") as string; | ||
} | ||
|
||
} | ||
public static readonly string ProgFiles32; | ||
public static readonly string ProgFiles64; | ||
public static readonly string VSInstall; | ||
public static readonly string Windows; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace Cosmos.Build.Installer | ||
{ | ||
/// <summary> | ||
/// Version of Visual Studio | ||
/// </summary> | ||
public enum VsVersion | ||
{ | ||
/// <summary> | ||
/// Visual Studio VS 2013 | ||
/// </summary> | ||
Vs2013, | ||
|
||
/// <summary> | ||
/// Visual Studio VS 2015 | ||
/// </summary> | ||
Vs2015 | ||
} | ||
} |