File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
modules/mono/editor/GodotTools/GodotTools.OpenVisualStudio Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -46,19 +46,24 @@ private static int Main(string[] args)
46
46
47
47
if ( dte == null )
48
48
{
49
- // Open a new instance
50
- dte = TryVisualStudioLaunch ( "VisualStudio.DTE.17.0" ) ;
49
+ // Try starting from the higher version
50
+ string [ ] vsVersions = {
51
+ "VisualStudio.DTE.18.0" ,
52
+ "VisualStudio.DTE.17.0" ,
53
+ "VisualStudio.DTE.16.0"
54
+ } ;
55
+
56
+ foreach ( string vsVersion in vsVersions )
57
+ {
58
+ dte = TryVisualStudioLaunch ( vsVersion ) ;
59
+ if ( dte != null )
60
+ break ;
61
+ }
51
62
52
63
if ( dte == null )
53
64
{
54
- // Launch of VS 2022 failed, fallback to 2019
55
- dte = TryVisualStudioLaunch ( "VisualStudio.DTE.16.0" ) ;
56
-
57
- if ( dte == null )
58
- {
59
- Console . Error . WriteLine ( "Visual Studio not found" ) ;
60
- return 1 ;
61
- }
65
+ Console . Error . WriteLine ( "Visual Studio not found" ) ;
66
+ return 1 ;
62
67
}
63
68
64
69
dte . UserControl = true ;
@@ -189,7 +194,7 @@ private static int Main(string[] args)
189
194
continue ;
190
195
191
196
// The digits after the colon are the process ID
192
- if ( ! Regex . IsMatch ( ppszDisplayName , "!VisualStudio.DTE.1[6-7 ].0:[0-9]" ) )
197
+ if ( ! Regex . IsMatch ( ppszDisplayName , "!VisualStudio.DTE.1[6-8 ].0:[0-9]" ) )
193
198
continue ;
194
199
195
200
if ( pprot . GetObject ( moniker [ 0 ] , out object ppunkObject ) == 0 )
@@ -292,4 +297,4 @@ private interface IOleMessageFilter
292
297
293
298
#endregion
294
299
}
295
- }
300
+ }
You can’t perform that action at this time.
0 commit comments