The dotnet
command line tool can build and publish projects.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
|
#r "paket:
nuget Fake.DotNet.Cli //"
open Fake.DotNet
// Lazily install DotNet SDK in the correct version if not available
let install = lazy DotNet.install DotNet.Versions.Release_2_1_4
// Define general properties across various commands (with arguments)
let inline withWorkDir wd =
DotNet.Options.lift install.Value
>> DotNet.Options.withWorkingDirectory wd
// Set general properties without arguments
let inline dotnetSimple arg = DotNet.Options.lift install.Value arg
// Use defined properties on "DotNet.Exec"
DotNet.exec (withWorkDir "./test") "build" ""
DotNet.exec dotnetSimple "build" "myproject.fsproj"
DotNet.exec dotnetSimple "build" "mysolution.sln"
// Use defined properties on more generalized functions like "DotNet.Restore"
DotNet.restore dotnetSimple "mysolution.sln"
// Define more general properties in addition to the general ones
DotNet.restore (fun args ->
{ args with
NoCache = true
} |> dotnetSimple) "mysolution.sln"
// Define more general properties in addition to the general ones, with arugments
DotNet.restore (fun args ->
{ args with
Runtime = Some "win7-x86"
} |> withWorkDir "./test" ) "mysolution.sln"
|
More API Documentation
val install : Lazy<obj>
val withWorkDir : wd:'a -> ('b -> 'c)
val wd : 'a
property System.Lazy.Value: obj
val dotnetSimple : arg:'a -> 'b
val arg : 'a
union case Option.Some: Value: 'T -> Option<'T>