Merge pull request #1881 from github/feature/visual-studio-2019

Add support for Visual Studio 2019
This commit is contained in:
Jamie Cansdale 2018-09-05 11:24:41 +01:00 коммит произвёл GitHub
Родитель 7fb654e9ab 5981bf0008
Коммит c90154d153
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 46 добавлений и 216 удалений

Просмотреть файл

@ -160,9 +160,6 @@
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\submodules\octokit.net\Octokit\Octokit.csproj"> <ProjectReference Include="..\..\submodules\octokit.net\Octokit\Octokit.csproj">

Просмотреть файл

@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="GitHub.InlineReviews.56b6fdce-e5b1-4ec3-9837-af4545ba933e" Version="2.0" Language="en-US" Publisher="GitHub, Inc" />
<DisplayName>GitHub Inline Reviews</DisplayName>
<Description xml:space="preserve">Inline reviews for GitHub pull requests</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,15.0]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0]" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
</PackageManifest>

Просмотреть файл

@ -74,9 +74,6 @@
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI\ReactiveUI_Net45.csproj"> <ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI\ReactiveUI_Net45.csproj">

Просмотреть файл

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="GitHub.StartPage.760cdaee-08cf-4807-8e49-227d5a3fdaf6" Version="0.2.0.0" Language="en-US" Publisher="GitHub, Inc" />
<DisplayName>GitHub Start Page</DisplayName>
<Description xml:space="preserve">GitHub on your Start Page, helping you clone!</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0]" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.15.0" DisplayName="Visual Studio MPF 15.0" d:Source="Installed" Version="[15.0]" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25824.0,16.0)" DisplayName="Visual Studio core editor" />
</Prerequisites>
</PackageManifest>

Просмотреть файл

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -14,27 +15,25 @@ namespace GitHub.TeamFoundation
internal class RegistryHelper internal class RegistryHelper
{ {
static readonly ILogger log = LogManager.ForContext<RegistryHelper>(); static readonly ILogger log = LogManager.ForContext<RegistryHelper>();
const string TEGitKey = @"Software\Microsoft\VisualStudio\14.0\TeamFoundation\GitSourceControl";
static RegistryKey OpenGitKey(string path) static RegistryKey OpenGitKey(string path)
{ {
return Microsoft.Win32.Registry.CurrentUser.OpenSubKey(TEGitKey + "\\" + path, true); var keyName = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\TeamFoundation\\GitSourceControl\\{path}";
return Registry.CurrentUser.OpenSubKey(keyName, true);
} }
internal static IEnumerable<ILocalRepositoryModel> PokeTheRegistryForRepositoryList() internal static IEnumerable<ILocalRepositoryModel> PokeTheRegistryForRepositoryList()
{ {
var key = OpenGitKey("Repositories"); using (var key = OpenGitKey("Repositories"))
{
if (key == null)
{
return Enumerable.Empty<ILocalRepositoryModel>();
}
if (key != null)
{
using (key)
{
return key.GetSubKeyNames().Select(x => return key.GetSubKeyNames().Select(x =>
{ {
var subkey = key.OpenSubKey(x); using (var subkey = key.OpenSubKey(x))
if (subkey != null)
{
using (subkey)
{ {
try try
{ {
@ -46,20 +45,14 @@ namespace GitHub.TeamFoundation
{ {
// no sense spamming the log, the registry might have ton of stale things we don't care about // no sense spamming the log, the registry might have ton of stale things we don't care about
} }
}
}
return null; return null;
}
}) })
.Where(x => x != null) .Where(x => x != null)
.ToList(); .ToList();
} }
} }
return new ILocalRepositoryModel[0];
}
internal static string PokeTheRegistryForLocalClonePath() internal static string PokeTheRegistryForLocalClonePath()
{ {
using (var key = OpenGitKey("General")) using (var key = OpenGitKey("General"))
@ -68,15 +61,16 @@ namespace GitHub.TeamFoundation
} }
} }
const string NewProjectDialogKeyPath = @"Software\Microsoft\VisualStudio\14.0\NewProjectDialog";
const string MRUKeyPath = "MRUSettingsLocalProjectLocationEntries"; const string MRUKeyPath = "MRUSettingsLocalProjectLocationEntries";
internal static string SetDefaultProjectPath(string path) internal static string SetDefaultProjectPath(string path)
{ {
var newProjectDialogKeyPath = $"Software\\Microsoft\\VisualStudio\\{MajorVersion}.0\\NewProjectDialog";
var old = String.Empty; var old = String.Empty;
try try
{ {
var newProjectKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(NewProjectDialogKeyPath, true) ?? var newProjectKey = Registry.CurrentUser.OpenSubKey(newProjectDialogKeyPath, true) ??
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(NewProjectDialogKeyPath); Registry.CurrentUser.CreateSubKey(newProjectDialogKeyPath);
if (newProjectKey == null) if (newProjectKey == null)
{ {
@ -84,7 +78,7 @@ namespace GitHub.TeamFoundation
string.Format( string.Format(
CultureInfo.CurrentCulture, CultureInfo.CurrentCulture,
"Could not open or create registry key '{0}'", "Could not open or create registry key '{0}'",
NewProjectDialogKeyPath)); newProjectDialogKeyPath));
} }
using (newProjectKey) using (newProjectKey)
@ -132,5 +126,8 @@ namespace GitHub.TeamFoundation
} }
return old; return old;
} }
// Major version number of the current devenv process
static int MajorVersion => Process.GetCurrentProcess().MainModule.FileVersionInfo.FileMajorPart;
} }
} }

Просмотреть файл

@ -1,4 +1,4 @@
#if TEAMEXPLORER15 #if !TEAMEXPLORER14
// Microsoft.VisualStudio.Shell.Framework has an alias to avoid conflict with IAsyncServiceProvider // Microsoft.VisualStudio.Shell.Framework has an alias to avoid conflict with IAsyncServiceProvider
extern alias SF15; extern alias SF15;
using ServiceProgressData = SF15::Microsoft.VisualStudio.Shell.ServiceProgressData; using ServiceProgressData = SF15::Microsoft.VisualStudio.Shell.ServiceProgressData;

Просмотреть файл

@ -179,6 +179,9 @@
<Compile Include="..\GitHub.TeamFoundation.14\Home\ForkNavigationItem.cs"> <Compile Include="..\GitHub.TeamFoundation.14\Home\ForkNavigationItem.cs">
<Link>Home\ForkNavigationItem.cs</Link> <Link>Home\ForkNavigationItem.cs</Link>
</Compile> </Compile>
<Compile Include="..\GitHub.TeamFoundation.14\RegistryHelper.cs">
<Link>RegistryHelper.cs</Link>
</Compile>
<Compile Include="..\GitHub.TeamFoundation.14\Services\LocalRepositoryModelFactory.cs"> <Compile Include="..\GitHub.TeamFoundation.14\Services\LocalRepositoryModelFactory.cs">
<Link>Services\LocalRepositoryModelFactory.cs</Link> <Link>Services\LocalRepositoryModelFactory.cs</Link>
</Compile> </Compile>
@ -248,7 +251,6 @@
<Compile Include="..\GitHub.TeamFoundation.14\Services\VSGitServices.cs"> <Compile Include="..\GitHub.TeamFoundation.14\Services\VSGitServices.cs">
<Link>Services\VSGitServices.cs</Link> <Link>Services\VSGitServices.cs</Link>
</Compile> </Compile>
<Compile Include="RegistryHelper.cs" />
<Compile Include="..\common\SolutionInfo.cs"> <Compile Include="..\common\SolutionInfo.cs">
<Link>Properties\SolutionInfo.cs</Link> <Link>Properties\SolutionInfo.cs</Link>
</Compile> </Compile>

Просмотреть файл

@ -1,124 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GitHub.Logging;
using GitHub.Models;
using GitHub.Services;
using Microsoft.Win32;
using Serilog;
namespace GitHub.TeamFoundation
{
internal class RegistryHelper
{
static readonly ILogger log = LogManager.ForContext<RegistryHelper>();
const string TEGitKey = @"Software\Microsoft\VisualStudio\15.0\TeamFoundation\GitSourceControl";
static RegistryKey OpenGitKey(string path)
{
return Microsoft.Win32.Registry.CurrentUser.OpenSubKey(TEGitKey + "\\" + path, true);
}
internal static IEnumerable<ILocalRepositoryModel> PokeTheRegistryForRepositoryList()
{
using (var key = OpenGitKey("Repositories"))
{
return key.GetSubKeyNames().Select(x =>
{
using (var subkey = key.OpenSubKey(x))
{
try
{
var path = subkey?.GetValue("Path") as string;
if (path != null)
return new LocalRepositoryModel(path, GitService.GitServiceHelper);
}
catch (Exception)
{
// no sense spamming the log, the registry might have ton of stale things we don't care about
}
return null;
}
})
.Where(x => x != null)
.ToList();
}
}
internal static string PokeTheRegistryForLocalClonePath()
{
using (var key = OpenGitKey("General"))
{
return (string)key?.GetValue("DefaultRepositoryPath", string.Empty, RegistryValueOptions.DoNotExpandEnvironmentNames);
}
}
const string NewProjectDialogKeyPath = @"Software\Microsoft\VisualStudio\15.0\NewProjectDialog";
const string MRUKeyPath = "MRUSettingsLocalProjectLocationEntries";
internal static string SetDefaultProjectPath(string path)
{
var old = String.Empty;
try
{
var newProjectKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(NewProjectDialogKeyPath, true) ??
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(NewProjectDialogKeyPath);
if (newProjectKey == null)
{
throw new GitHubLogicException(
string.Format(
CultureInfo.CurrentCulture,
"Could not open or create registry key '{0}'",
NewProjectDialogKeyPath));
}
using (newProjectKey)
{
var mruKey = newProjectKey.OpenSubKey(MRUKeyPath, true) ??
Microsoft.Win32.Registry.CurrentUser.CreateSubKey(MRUKeyPath);
if (mruKey == null)
{
throw new GitHubLogicException(
string.Format(
CultureInfo.CurrentCulture,
"Could not open or create registry key '{0}'",
MRUKeyPath));
}
using (mruKey)
{
// is this already the default path? bail
old = (string)mruKey.GetValue("Value0", string.Empty, RegistryValueOptions.DoNotExpandEnvironmentNames);
if (String.Equals(path.TrimEnd('\\'), old.TrimEnd('\\'), StringComparison.CurrentCultureIgnoreCase))
return old;
// grab the existing list of recent paths, throwing away the last one
var numEntries = (int)mruKey.GetValue("MaximumEntries", 5);
var entries = new List<string>(numEntries);
for (int i = 0; i < numEntries - 1; i++)
{
var val = (string)mruKey.GetValue("Value" + i, String.Empty, RegistryValueOptions.DoNotExpandEnvironmentNames);
if (!String.IsNullOrEmpty(val))
entries.Add(val);
}
newProjectKey.SetValue("LastUsedNewProjectPath", path);
mruKey.SetValue("Value0", path);
// bump list of recent paths one entry down
for (int i = 0; i < entries.Count; i++)
mruKey.SetValue("Value" + (i + 1), entries[i]);
}
}
}
catch (Exception ex)
{
log.Error(ex, "Error setting the create project path in the registry");
}
return old;
}
}
}

Просмотреть файл

@ -30,6 +30,7 @@ namespace GitHub.Services
case 14: case 14:
return Create(() => new VSGitExt14(asyncServiceProvider)); return Create(() => new VSGitExt14(asyncServiceProvider));
case 15: case 15:
case 16:
return Create(() => new VSGitExt15(asyncServiceProvider)); return Create(() => new VSGitExt15(asyncServiceProvider));
default: default:
log.Error("There is no IVSGitExt implementation for DTE version {Version}", vsVersion); log.Error("There is no IVSGitExt implementation for DTE version {Version}", vsVersion);

Просмотреть файл

@ -13,13 +13,13 @@
<Tags>GitHub;git;open source;source control;branch;pull request;team explorer;commit;publish</Tags> <Tags>GitHub;git;open source;source control;branch;pull request;team explorer;commit;publish</Tags>
</Metadata> </Metadata>
<Installation AllUsers="true" Experimental="false"> <Installation AllUsers="true" Experimental="false">
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,15.0]" /> <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,17.0)" />
<InstallationTarget Version="[15.0,16.0)" Id="Microsoft.VisualStudio.IntegratedShell" /> <InstallationTarget Id="Microsoft.VisualStudio.IntegratedShell" Version="[15.0,17.0)" />
</Installation> </Installation>
<Dependencies> <Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" /> <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0,]" /> <Dependency Id="Microsoft.VisualStudio.MPF.14.0" DisplayName="Visual Studio MPF 14.0" d:Source="Installed" Version="[14.0,)" />
<Dependency Id="Microsoft.VisualStudio.TeamFoundation.TeamExplorer.Extensions" DisplayName="Team Explorer" d:Source="Installed" Version="[14.0,16.0)" /> <Dependency Id="Microsoft.VisualStudio.TeamFoundation.TeamExplorer.Extensions" DisplayName="Team Explorer" d:Source="Installed" Version="[14.0,)" />
</Dependencies> </Dependencies>
<Assets> <Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" /> <Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
@ -30,7 +30,7 @@
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.App" Path="|GitHub.App|" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.App" Path="|GitHub.App|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.Services.Vssdk" Path="|GitHub.Services.Vssdk|" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.Services.Vssdk" Path="|GitHub.Services.Vssdk|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.14" TargetVersion="[14.0,15.0)" Path="|GitHub.TeamFoundation.14|" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.14" TargetVersion="[14.0,15.0)" Path="|GitHub.TeamFoundation.14|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[15.0,16.0)" Path="|GitHub.TeamFoundation.15|" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[15.0,17.0)" Path="|GitHub.TeamFoundation.15|" />
<!-- Sometimes the version of `ServiceHub.VSDetouredHost.exe` is used when installing for Visual Studio 2017, see https://github.com/github/VisualStudio/pull/1875 --> <!-- Sometimes the version of `ServiceHub.VSDetouredHost.exe` is used when installing for Visual Studio 2017, see https://github.com/github/VisualStudio/pull/1875 -->
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[1.0,2.0)" Path="|GitHub.TeamFoundation.15|" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="GitHub.TeamFoundation.15" TargetVersion="[1.0,2.0)" Path="|GitHub.TeamFoundation.15|" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="GitHub.InlineReviewsPackage" Path="|GitHub.InlineReviews;PkgdefProjectOutputGroup|" /> <Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="GitHub.InlineReviewsPackage" Path="|GitHub.InlineReviews;PkgdefProjectOutputGroup|" />
@ -39,6 +39,6 @@
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="File" Path="Rothko.dll" /> <Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="File" Path="Rothko.dll" />
</Assets> </Assets>
<Prerequisites> <Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25824.0,16.0)" DisplayName="Visual Studio core editor" /> <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0.25824.0,)" DisplayName="Visual Studio core editor" />
</Prerequisites> </Prerequisites>
</PackageManifest> </PackageManifest>