mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 05:05:00 +00:00
feature: add support for Visual Studio as external tool (#648)
* feature: support Visual Studio external tool on Windows * feature: when opening in Visual Studio, try to locate solution file
This commit is contained in:
parent
fba84c8297
commit
1d0098703e
3 changed files with 55 additions and 6 deletions
|
@ -134,6 +134,7 @@ namespace SourceGit.Native
|
|||
finder.Fleet(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\Programs\\Fleet\\Fleet.exe");
|
||||
finder.FindJetBrainsFromToolbox(() => $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)}\\JetBrains\\Toolbox");
|
||||
finder.SublimeText(FindSublimeText);
|
||||
finder.VisualStudio(FindVisualStudio);
|
||||
return finder.Founded;
|
||||
}
|
||||
|
||||
|
@ -313,6 +314,25 @@ namespace SourceGit.Native
|
|||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private string FindVisualStudio()
|
||||
{
|
||||
var localMachine = Microsoft.Win32.RegistryKey.OpenBaseKey(
|
||||
Microsoft.Win32.RegistryHive.LocalMachine,
|
||||
Microsoft.Win32.RegistryView.Registry64);
|
||||
|
||||
// Get default class for VisualStudio.Launcher.sln - the handler for *.sln files
|
||||
if (localMachine.OpenSubKey(@"SOFTWARE\Classes\VisualStudio.Launcher.sln\CLSID") is Microsoft.Win32.RegistryKey launcher)
|
||||
{
|
||||
// Get actual path to the executable
|
||||
if (launcher.GetValue(string.Empty) is string CLSID && localMachine.OpenSubKey(@$"SOFTWARE\Classes\CLSID\{CLSID}\LocalServer32") is Microsoft.Win32.RegistryKey devenv && devenv.GetValue(string.Empty) is string localServer32)
|
||||
{
|
||||
return localServer32!.Trim('\"');
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void OpenFolderAndSelectFile(string folderPath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue