Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 4995603

Browse files
authored
Merge branch 'master' into fixes/1408-change-branch-event-squashed
2 parents 7f8011e + 657b04a commit 4995603

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

src/GitHub.Exports/GitHub.Exports.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
<HintPath>..\..\packages\Microsoft.VisualStudio.ComponentModelHost.14.0.25424\lib\net45\Microsoft.VisualStudio.ComponentModelHost.dll</HintPath>
6464
<Private>True</Private>
6565
</Reference>
66+
<Reference Include="Microsoft.VisualStudio.Setup.Configuration.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
67+
<HintPath>..\..\packages\Microsoft.VisualStudio.Setup.Configuration.Interop.1.15.103\lib\net35\Microsoft.VisualStudio.Setup.Configuration.Interop.dll</HintPath>
68+
<EmbedInteropTypes>True</EmbedInteropTypes>
69+
</Reference>
6670
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
6771
<HintPath>..\..\packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
6872
<Private>True</Private>

src/GitHub.Exports/Services/VSServices.cs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
using System;
22
using System.ComponentModel.Composition;
3+
using System.Diagnostics;
34
using System.Globalization;
45
using System.IO;
56
using System.Linq;
7+
using System.Text.RegularExpressions;
68
using GitHub.Logging;
79
using GitHub.VisualStudio;
810
using Microsoft.VisualStudio;
11+
using Microsoft.VisualStudio.Setup.Configuration;
12+
using Microsoft.VisualStudio.Shell;
913
using Microsoft.VisualStudio.Shell.Interop;
1014
using Rothko;
1115
using Serilog;
@@ -145,22 +149,28 @@ void TryCleanupSolutionUserFiles(IOperatingSystem os, string repoPath, string sl
145149

146150
const string RegistryRootKey = @"Software\Microsoft\VisualStudio";
147151
const string EnvVersionKey = "EnvVersion";
152+
const string InstallationNamePrefix = "VisualStudio/";
148153
string GetVSVersion()
149154
{
150155
var version = typeof(Microsoft.VisualStudio.Shell.ActivityLog).Assembly.GetName().Version;
151156
var keyPath = String.Format(CultureInfo.InvariantCulture, "{0}\\{1}.{2}_Config\\SplashInfo", RegistryRootKey, version.Major, version.Minor);
152157
try
153158
{
154-
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(keyPath))
159+
if (version.Major == 14)
155160
{
156-
var value = (string)key.GetValue(EnvVersionKey, String.Empty);
157-
if (!String.IsNullOrEmpty(value))
158-
return value;
161+
using (var key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(keyPath))
162+
{
163+
var value = (string)key.GetValue(EnvVersionKey, String.Empty);
164+
if (!String.IsNullOrEmpty(value))
165+
return value;
166+
}
167+
}
168+
else
169+
{
170+
var setupConfiguration = new SetupConfiguration();
171+
var setupInstance = setupConfiguration.GetInstanceForCurrentProcess();
172+
return setupInstance.GetInstallationName().TrimPrefix(InstallationNamePrefix);
159173
}
160-
// fallback to poking the CommonIDE assembly, which most closely follows the advertised version.
161-
var asm = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.FullName.StartsWith("Microsoft.VisualStudio.CommonIDE", StringComparison.OrdinalIgnoreCase));
162-
if (asm != null)
163-
return asm.GetName().Version.ToString();
164174
}
165175
catch(Exception ex)
166176
{

src/GitHub.Exports/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<package id="LibGit2Sharp.NativeBinaries" version="1.0.164" targetFramework="net461" />
55
<package id="Microsoft.VisualStudio.ComponentModelHost" version="14.0.25424" targetFramework="net461" />
66
<package id="Microsoft.VisualStudio.OLE.Interop" version="7.10.6070" targetFramework="net461" />
7+
<package id="Microsoft.VisualStudio.Setup.Configuration.Interop" version="1.15.103" targetFramework="net461" developmentDependency="true" />
78
<package id="Microsoft.VisualStudio.Shell.14.0" version="14.3.25407" targetFramework="net461" />
89
<package id="Microsoft.VisualStudio.Shell.Immutable.10.0" version="10.0.30319" targetFramework="net461" />
910
<package id="Microsoft.VisualStudio.Shell.Interop" version="7.10.6071" targetFramework="net461" />

0 commit comments

Comments
 (0)