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

Commit c90154d

Browse files
authored
Merge pull request #1881 from github/feature/visual-studio-2019
Add support for Visual Studio 2019
2 parents 7fb654e + 5981bf0 commit c90154d

File tree

10 files changed

+43
-213
lines changed

10 files changed

+43
-213
lines changed

src/GitHub.InlineReviews/GitHub.InlineReviews.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,6 @@
160160
<None Include="packages.config">
161161
<SubType>Designer</SubType>
162162
</None>
163-
<None Include="source.extension.vsixmanifest">
164-
<SubType>Designer</SubType>
165-
</None>
166163
</ItemGroup>
167164
<ItemGroup>
168165
<ProjectReference Include="..\..\submodules\octokit.net\Octokit\Octokit.csproj">

src/GitHub.InlineReviews/source.extension.vsixmanifest

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/GitHub.StartPage/GitHub.StartPage.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@
7474
<None Include="packages.config">
7575
<SubType>Designer</SubType>
7676
</None>
77-
<None Include="source.extension.vsixmanifest">
78-
<SubType>Designer</SubType>
79-
</None>
8077
</ItemGroup>
8178
<ItemGroup>
8279
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI\ReactiveUI_Net45.csproj">

src/GitHub.StartPage/source.extension.vsixmanifest

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/GitHub.TeamFoundation.14/RegistryHelper.cs

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Diagnostics;
34
using System.Globalization;
45
using System.IO;
56
using System.Linq;
@@ -14,50 +15,42 @@ namespace GitHub.TeamFoundation
1415
internal class RegistryHelper
1516
{
1617
static readonly ILogger log = LogManager.ForContext<RegistryHelper>();
17-
const string TEGitKey = @"Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl";
18+
1819
static RegistryKey OpenGitKey(string path)
1920
{
20-
return Microsoft.Win32.Registry.CurrentUser.OpenSubKey(TEGitKey + "\\" + path, true);
21+
var keyName = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\TeamFoundation\\GitSourceControl\\{path}";
22+
return Registry.CurrentUser.OpenSubKey(keyName, true);
2123
}
2224

2325
internal static IEnumerable<ILocalRepositoryModel> PokeTheRegistryForRepositoryList()
2426
{
25-
var key = OpenGitKey("Repositories");
26-
27-
if (key != null)
27+
using (var key = OpenGitKey("Repositories"))
2828
{
29-
using (key)
29+
if (key == null)
3030
{
31-
return key.GetSubKeyNames().Select(x =>
32-
{
33-
var subkey = key.OpenSubKey(x);
31+
return Enumerable.Empty<ILocalRepositoryModel>();
32+
}
3433

35-
if (subkey != null)
34+
return key.GetSubKeyNames().Select(x =>
35+
{
36+
using (var subkey = key.OpenSubKey(x))
37+
{
38+
try
3639
{
37-
using (subkey)
38-
{
39-
try
40-
{
41-
var path = subkey?.GetValue("Path") as string;
42-
if (path != null && Directory.Exists(path))
43-
return new LocalRepositoryModel(path, GitService.GitServiceHelper);
44-
}
45-
catch (Exception)
46-
{
47-
// no sense spamming the log, the registry might have ton of stale things we don't care about
48-
}
49-
50-
}
40+
var path = subkey?.GetValue("Path") as string;
41+
if (path != null && Directory.Exists(path))
42+
return new LocalRepositoryModel(path, GitService.GitServiceHelper);
43+
}
44+
catch (Exception)
45+
{
46+
// no sense spamming the log, the registry might have ton of stale things we don't care about
5147
}
52-
5348
return null;
54-
})
55-
.Where(x => x != null)
56-
.ToList();
57-
}
49+
}
50+
})
51+
.Where(x => x != null)
52+
.ToList();
5853
}
59-
60-
return new ILocalRepositoryModel[0];
6154
}
6255

6356
internal static string PokeTheRegistryForLocalClonePath()
@@ -68,23 +61,24 @@ internal static string PokeTheRegistryForLocalClonePath()
6861
}
6962
}
7063

71-
const string NewProjectDialogKeyPath = @"Software\Microsoft\VisualStudio\14.0\NewProjectDialog";
7264
const string MRUKeyPath = "MRUSettingsLocalProjectLocationEntries";
7365
internal static string SetDefaultProjectPath(string path)
7466
{
67+
var newProjectDialogKeyPath = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\NewProjectDialog";
68+
7569
var old = String.Empty;
7670
try
7771
{
78-
var newProjectKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(NewProjectDialogKeyPath, true) ??
79-
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(NewProjectDialogKeyPath);
72+
var newProjectKey = Registry.CurrentUser.OpenSubKey(newProjectDialogKeyPath, true) ??
73+
Registry.CurrentUser.CreateSubKey(newProjectDialogKeyPath);
8074

8175
if (newProjectKey == null)
8276
{
8377
throw new GitHubLogicException(
8478
string.Format(
8579
CultureInfo.CurrentCulture,
8680
"Could not open or create registry key '{0}'",
87-
NewProjectDialogKeyPath));
81+
newProjectDialogKeyPath));
8882
}
8983

9084
using (newProjectKey)
@@ -132,5 +126,8 @@ internal static string SetDefaultProjectPath(string path)
132126
}
133127
return old;
134128
}
129+
130+
// Major version number of the current devenv process
131+
static int MajorVersion => Process.GetCurrentProcess().MainModule.FileVersionInfo.FileMajorPart;
135132
}
136133
}

src/GitHub.TeamFoundation.14/Services/VSGitServices.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if TEAMEXPLORER15
1+
#if !TEAMEXPLORER14
22
// Microsoft.VisualStudio.Shell.Framework has an alias to avoid conflict with IAsyncServiceProvider
33
extern alias SF15;
44
using ServiceProgressData = SF15::Microsoft.VisualStudio.Shell.ServiceProgressData;

src/GitHub.TeamFoundation.15/GitHub.TeamFoundation.15.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@
179179
<Compile Include="..\GitHub.TeamFoundation.14\Home\ForkNavigationItem.cs">
180180
<Link>Home\ForkNavigationItem.cs</Link>
181181
</Compile>
182+
<Compile Include="..\GitHub.TeamFoundation.14\RegistryHelper.cs">
183+
<Link>RegistryHelper.cs</Link>
184+
</Compile>
182185
<Compile Include="..\GitHub.TeamFoundation.14\Services\LocalRepositoryModelFactory.cs">
183186
<Link>Services\LocalRepositoryModelFactory.cs</Link>
184187
</Compile>
@@ -248,7 +251,6 @@
248251
<Compile Include="..\GitHub.TeamFoundation.14\Services\VSGitServices.cs">
249252
<Link>Services\VSGitServices.cs</Link>
250253
</Compile>
251-
<Compile Include="RegistryHelper.cs" />
252254
<Compile Include="..\common\SolutionInfo.cs">
253255
<Link>Properties\SolutionInfo.cs</Link>
254256
</Compile>

src/GitHub.TeamFoundation.15/RegistryHelper.cs

Lines changed: 0 additions & 124 deletions
This file was deleted.

src/GitHub.VisualStudio/Services/VSGitExtFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public IVSGitExt Create()
3030
case 14:
3131
return Create(() => new VSGitExt14(asyncServiceProvider));
3232
case 15:
33+
case 16:
3334
return Create(() => new VSGitExt15(asyncServiceProvider));
3435
default:
3536
log.Error("There is no IVSGitExt implementation for DTE version {Version}", vsVersion);

src/GitHub.VisualStudio/source.extension.vsixmanifest

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
<Tags>GitHub;git;open source;source control;branch;pull request;team explorer;commit;publish</Tags>
1414
</Metadata>
1515
<Installation AllUsers="true" Experimental="false">
16-
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,15.0]" />
17-
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.IntegratedShell" />
16+
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,17.0)" />
17+
<InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="[15.0,17.0)" />
1818
</Installation>
1919
<Dependencies>
2020
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
21-
<Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0,]" />
22-
<Dependency Id="Microsoft.VisualStudio.TeamFoundation.TeamExplorer.Extensions" DisplayName="Team Explorer" d:Source="Installed" Version="[14.0,16.0)" />
21+
<Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0,)" />
22+
<Dependency Id="Microsoft.VisualStudio.TeamFoundation.TeamExplorer.Extensions" DisplayName="Team Explorer" d:Source="Installed" Version="[14.0,)" />
2323
</Dependencies>
2424
<Assets>
2525
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
@@ -30,7 +30,7 @@
3030
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.App" Path="|GitHub.App|" />
3131
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.Services.Vssdk" Path="|GitHub.Services.Vssdk|" />
3232
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.14" TargetVersion="[14.0,15.0)" Path="|GitHub.TeamFoundation.14|" />
33-
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[15.0,16.0)" Path="|GitHub.TeamFoundation.15|" />
33+
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[15.0,17.0)" Path="|GitHub.TeamFoundation.15|" />
3434
<!-- Sometimes the version of `ServiceHub.VSDetouredHost.exe` is used when installing for Visual Studio 2017, see https://github.com/github/VisualStudio/pull/1875 -->
3535
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[1.0,2.0)" Path="|GitHub.TeamFoundation.15|" />
3636
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="GitHub.InlineReviewsPackage" Path="|GitHub.InlineReviews;PkgdefProjectOutputGroup|" />
@@ -39,6 +39,6 @@
3939
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="File" Path="Rothko.dll" />
4040
</Assets>
4141
<Prerequisites>
42-
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25824.0,16.0)" DisplayName="Visual Studio core editor" />
42+
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25824.0,)" DisplayName="Visual Studio core editor" />
4343
</Prerequisites>
4444
</PackageManifest>

0 commit comments

Comments
 (0)