You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Add Visual Studio 2022 support with fallback to 2019
This commit is contained in:
@@ -47,9 +47,13 @@ namespace GodotTools.OpenVisualStudio
|
|||||||
if (dte == null)
|
if (dte == null)
|
||||||
{
|
{
|
||||||
// Open a new instance
|
// Open a new instance
|
||||||
|
dte = TryVisualStudioLaunch("VisualStudio.DTE.17.0");
|
||||||
|
|
||||||
var visualStudioDteType = Type.GetTypeFromProgID("VisualStudio.DTE.16.0", throwOnError: true);
|
if (dte == null)
|
||||||
dte = (DTE)Activator.CreateInstance(visualStudioDteType);
|
{
|
||||||
|
// Launch of VS 2022 failed, fallback to 2019
|
||||||
|
dte = TryVisualStudioLaunch("VisualStudio.DTE.16.0");
|
||||||
|
}
|
||||||
|
|
||||||
dte.UserControl = true;
|
dte.UserControl = true;
|
||||||
|
|
||||||
@@ -133,6 +137,21 @@ namespace GodotTools.OpenVisualStudio
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static DTE TryVisualStudioLaunch(string version)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var visualStudioDteType = Type.GetTypeFromProgID(version, throwOnError: true);
|
||||||
|
var dte = (DTE)Activator.CreateInstance(visualStudioDteType);
|
||||||
|
|
||||||
|
return dte;
|
||||||
|
}
|
||||||
|
catch (COMException)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static DTE FindInstanceEditingSolution(string solutionPath)
|
private static DTE FindInstanceEditingSolution(string solutionPath)
|
||||||
{
|
{
|
||||||
if (GetRunningObjectTable(0, out IRunningObjectTable pprot) != 0)
|
if (GetRunningObjectTable(0, out IRunningObjectTable pprot) != 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user