Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dotnet helpers to check for version and if CLI is installed #1310

Merged
merged 1 commit into from
Jul 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions src/app/FakeLib/DotNetCLIHelper.fs
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -21,7 +43,7 @@ type RestoreParams = {
}

let private DefaultRestoreParams : RestoreParams = {
ToolPath = "dotnet"
ToolPath = commandName
WorkingDir = Environment.CurrentDirectory
NoCache = false
TimeOut = TimeSpan.FromMinutes 30.
Expand Down