@@ -68,9 +68,14 @@ let isValidPath (path:string) =
68
68
|> Array.filter ( fun char -> path.Contains( char.ToString()))
69
69
|> Array.isEmpty
70
70
71
- /// Gets the list of valid directories included in the PATH environment variable .
71
+ /// Gets the list of valid directories included in the DOTNET_ROOT and PATH environment variables .
72
72
let pathDirectories =
73
- splitEnvironVar " PATH"
73
+ let pathEnvVarItems = splitEnvironVar " PATH"
74
+ let allPaths =
75
+ match environVarOrNone " DOTNET_ROOT" with
76
+ | None -> pathEnvVarItems
77
+ | Some dotnetRootPath -> dotnetRootPath:: pathEnvVarItems
78
+ allPaths
74
79
|> Seq.map ( fun value -> value.Trim())
75
80
|> Seq.filter ( fun value -> not ( String.IsNullOrEmpty value) && isValidPath value)
76
81
@@ -84,6 +89,12 @@ let tryFindFileOnPath (file : string) : string option =
84
89
|> Seq.append [ " ." ]
85
90
|> fun path -> tryFindFile path file
86
91
92
+ let dotnetExe =
93
+ let exeName = if isUnix then " dotnet" else " dotnet.exe"
94
+ match tryFindFileOnPath exeName with
95
+ | Some exe -> exe
96
+ | None -> exeName
97
+
87
98
/// Modifies the ProcessStartInfo according to the platform semantics
88
99
let platformInfoAction ( psi : ProcessStartInfo ) =
89
100
if isMonoRuntime && psi.FileName.EndsWith " .exe" then
@@ -92,11 +103,6 @@ let platformInfoAction (psi : ProcessStartInfo) =
92
103
93
104
if psi.FileName.ToLowerInvariant() .EndsWith( " .dll" ) then
94
105
// Run DotNetCore
95
- let exeName = if isUnix then " dotnet" else " dotnet.exe"
96
- let dotnetExe =
97
- match tryFindFileOnPath exeName with
98
- | Some exe -> exe
99
- | None -> exeName
100
106
psi.Arguments <- " \" " + psi.FileName + " \" " + psi.Arguments
101
107
psi.FileName <- dotnetExe
102
108
0 commit comments