Skip to content

Commit

Permalink
Merge pull request #1813 from severisv/b_dotnet_cli_find_dotnet_on_path
Browse files Browse the repository at this point in the history
Look for dotnet on path if it is not in the default install directory
  • Loading branch information
matthid authored Mar 9, 2018
2 parents 105fc9b + 90de2aa commit 4481e47
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/Fake.DotNet.Cli/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ module DotNet =
/// ## Parameters
///
/// - 'dotnetCliDir' - dotnet cli install directory
let private dotnetCliPath dotnetCliDir = dotnetCliDir @@ (if Environment.isUnix then "dotnet" else "dotnet.exe")
let private dotnetCliPath dotnetCliDir =
let defaultCliPath = dotnetCliDir @@ (if Environment.isUnix then "dotnet" else "dotnet.exe")
match File.Exists defaultCliPath with
| true -> defaultCliPath
| _ ->
Process.tryFindFileOnPath "dotnet"
|> function
| Some dotnet when File.Exists dotnet -> dotnet
| _ -> failwithf "Can't find dotnet CLI. Looked in %s and on PATH" defaultCliPath

/// Get .NET Core SDK download uri
let private getGenericDotNetCliInstallerUrl branch installerName =
Expand Down

0 comments on commit 4481e47

Please sign in to comment.