diff --git a/src/app/FakeLib/DotNetCLIHelper.fs b/src/app/FakeLib/DotNetCLIHelper.fs index 0310ccca8a3..7b9ab11eced 100644 --- a/src/app/FakeLib/DotNetCLIHelper.fs +++ b/src/app/FakeLib/DotNetCLIHelper.fs @@ -1,10 +1,32 @@ -/// Contains a task which can be used to run [DotCover](http://www.jetbrains.com/dotcover/) on .NET assemblies. +/// Contains a task which can be used to run dotnet CLI commands. module Fake.DotNet open Fake open System open System.Text +let commandName = "dotnet" + +/// Gets the installed dotnet version +let getVersion() = + let processResult = + ExecProcessAndReturnMessages (fun info -> + info.FileName <- commandName + info.WorkingDirectory <- Environment.CurrentDirectory + info.Arguments <- "--version") (TimeSpan.FromMinutes 30.) + + processResult.Messages |> separated "" + +/// Checks wether the dotnet CLI is installed +let isInstalled() = + let processResult = + ExecProcessAndReturnMessages (fun info -> + info.FileName <- commandName + info.WorkingDirectory <- Environment.CurrentDirectory + info.Arguments <- "--version") (TimeSpan.FromMinutes 30.) + + processResult.OK + /// DotNet Restore parameters type RestoreParams = { /// ToolPath - usually just "dotnet" @@ -21,7 +43,7 @@ type RestoreParams = { } let private DefaultRestoreParams : RestoreParams = { - ToolPath = "dotnet" + ToolPath = commandName WorkingDir = Environment.CurrentDirectory NoCache = false TimeOut = TimeSpan.FromMinutes 30.