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

Commit ace5498

Browse files
committed
Use DTE.Version to choose IVSGitExt implementaiton
1 parent 921f8c5 commit ace5498

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/GitHub.VisualStudio/GitHubPackage.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System;
55
using System.ComponentModel.Composition;
66
using System.Diagnostics;
7-
using System.Reflection;
87
using System.Runtime.InteropServices;
98
using System.Threading;
109
using System.Threading.Tasks;
@@ -22,6 +21,7 @@
2221
using Microsoft.VisualStudio;
2322
using Microsoft.VisualStudio.Shell;
2423
using Microsoft.VisualStudio.Shell.Interop;
24+
using EnvDTE;
2525
using Octokit;
2626
using Serilog;
2727
using Task = System.Threading.Tasks.Task;
@@ -282,8 +282,9 @@ async Task<object> CreateService(IAsyncServiceContainer container, CancellationT
282282
}
283283
else if (serviceType == typeof(IVSGitExt))
284284
{
285+
var dte = await GetServiceAsync(typeof(DTE)) as DTE;
285286
var sp = await GetServiceAsync(typeof(IGitHubServiceProvider)) as IGitHubServiceProvider;
286-
return CreateVSGitExt(sp);
287+
return CreateVSGitExt(dte.Version, sp);
287288
}
288289
else if (serviceType == typeof(IGitHubToolWindowManager))
289290
{
@@ -297,15 +298,16 @@ async Task<object> CreateService(IAsyncServiceContainer container, CancellationT
297298
}
298299
}
299300

300-
IVSGitExt CreateVSGitExt(IGitHubServiceProvider sp)
301+
IVSGitExt CreateVSGitExt(string dteVersion, IGitHubServiceProvider sp)
301302
{
302-
switch (VSVersion.Major)
303+
switch (dteVersion)
303304
{
304-
case 14:
305+
case "14.0":
305306
return new Lazy<IVSGitExt>(() => new VSGitExt14(sp)).Value;
306-
case 15:
307+
case "15.0":
307308
return new Lazy<IVSGitExt>(() => new VSGitExt15(sp)).Value;
308309
default:
310+
log.Error("There is no IVSGitExt implementation for DTE version {Version}", dteVersion);
309311
return null;
310312
}
311313
}

0 commit comments

Comments
 (0)