@@ -68,9 +68,14 @@ let isValidPath (path:string) =
6868 |> Array.filter ( fun char -> path.Contains( char.ToString()))
6969 |> Array.isEmpty
7070
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 .
7272let 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
7479 |> Seq.map ( fun value -> value.Trim())
7580 |> Seq.filter ( fun value -> not ( String.IsNullOrEmpty value) && isValidPath value)
7681
@@ -84,6 +89,12 @@ let tryFindFileOnPath (file : string) : string option =
8489 |> Seq.append [ " ." ]
8590 |> fun path -> tryFindFile path file
8691
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+
8798/// Modifies the ProcessStartInfo according to the platform semantics
8899let platformInfoAction ( psi : ProcessStartInfo ) =
89100 if isMonoRuntime && psi.FileName.EndsWith " .exe" then
@@ -92,11 +103,6 @@ let platformInfoAction (psi : ProcessStartInfo) =
92103
93104 if psi.FileName.ToLowerInvariant() .EndsWith( " .dll" ) then
94105 // 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
100106 psi.Arguments <- " \" " + psi.FileName + " \" " + psi.Arguments
101107 psi.FileName <- dotnetExe
102108
0 commit comments