@@ -73,12 +73,17 @@ public static string GetDotnetDirectory()
73
73
{
74
74
return environmentOverride ;
75
75
}
76
+ environmentOverride = Environment . GetEnvironmentVariable ( "DOTNET_ROOT" ) ;
77
+ if ( ! string . IsNullOrEmpty ( environmentOverride ) )
78
+ {
79
+ return environmentOverride ;
80
+ }
76
81
77
82
var dotnetExe = GetDotnetPath ( ) ;
78
83
79
84
if ( dotnetExe . IsNotNullOrEmpty ( ) && ! InteropHelper . RunningOnWindows )
80
85
{
81
- // e.g. on Linux the 'dotnet' command from PATH is a symlink so we need to
86
+ // e.g. on Linux the 'dotnet' command from PATH is a symbol link so we need to
82
87
// resolve it to get the actual path to the binary
83
88
dotnetExe = InteropHelper . Unix . RealPath ( dotnetExe ) ?? dotnetExe ;
84
89
}
@@ -97,15 +102,15 @@ public static string GetDotnetDirectory()
97
102
98
103
public static string ? ResolvePath ( string execName ) => ResolvePath ( execName , ".exe" ) ;
99
104
100
- public static string ? ResolvePath ( string execName , string ? ext )
105
+ public static string ? ResolvePath ( string execName , string ? windowsExt )
101
106
{
102
107
var executableName = execName ;
103
108
if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows )
104
109
&& ! Path . HasExtension ( execName )
105
- && string . IsNullOrEmpty ( ext )
110
+ && ! string . IsNullOrEmpty ( windowsExt )
106
111
)
107
112
{
108
- executableName += ext ;
113
+ executableName = $ " { executableName } { windowsExt } " ;
109
114
}
110
115
var searchPaths = Guard . NotNull ( Environment . GetEnvironmentVariable ( "PATH" ) )
111
116
. Split ( new [ ] { Path . PathSeparator } , options : StringSplitOptions . RemoveEmptyEntries )
0 commit comments