From bf23db59697a5a88d338ef2aea242a364d547ce2 Mon Sep 17 00:00:00 2001 From: Severin Sverdvik Date: Wed, 7 Mar 2018 17:53:18 +0100 Subject: [PATCH 1/2] Look for dotnet on path if it is not in the default install directory fixes #1810 #1599 --- src/app/Fake.DotNet.Cli/DotNet.fs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/Fake.DotNet.Cli/DotNet.fs b/src/app/Fake.DotNet.Cli/DotNet.fs index 549f2ddef05..05528bc87b6 100644 --- a/src/app/Fake.DotNet.Cli/DotNet.fs +++ b/src/app/Fake.DotNet.Cli/DotNet.fs @@ -48,7 +48,16 @@ let mutable DefaultDotNetCliDir = /// ## 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 = From 90de2aa95f1cf25f5cad3e3b54986692964422a7 Mon Sep 17 00:00:00 2001 From: Matthias Dittrich Date: Fri, 9 Mar 2018 17:37:46 +0100 Subject: [PATCH 2/2] Fix previous merge --- src/app/Fake.DotNet.Cli/DotNet.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/Fake.DotNet.Cli/DotNet.fs b/src/app/Fake.DotNet.Cli/DotNet.fs index e20905af8ff..e173c34e73a 100644 --- a/src/app/Fake.DotNet.Cli/DotNet.fs +++ b/src/app/Fake.DotNet.Cli/DotNet.fs @@ -59,7 +59,7 @@ module DotNet = Process.tryFindFileOnPath "dotnet" |> function | Some dotnet when File.Exists dotnet -> dotnet - | _ -> failwithf "Can't find dotnet CLI. Looked in %s and on PATH" defaultCliPath + | _ -> failwithf "Can't find dotnet CLI. Looked in %s and on PATH" defaultCliPath /// Get .NET Core SDK download uri let private getGenericDotNetCliInstallerUrl branch installerName =