diff --git a/build.fsx b/build.fsx index afc4cd1bfe..dd3661c675 100644 --- a/build.fsx +++ b/build.fsx @@ -188,9 +188,24 @@ Target "Build" (fun _ -> ) +let assertExitCodeZero x = + if x = 0 then () else + failwithf "Command failed with exit code %i" x + +let runCmdIn workDir exe = + Printf.ksprintf (fun args -> + Shell.Exec(exe, args, workDir) |> assertExitCodeZero) + +/// Execute a dotnet cli command +let dotnet workDir = runCmdIn workDir "dotnet" + Target "DotnetRestore" (fun _ -> netcoreFiles |> Seq.iter (fun proj -> + let dir = Path.GetDirectoryName proj + dotnet dir "restore" + + DotNetCli.Restore (fun c -> { c with Project = proj @@ -202,6 +217,10 @@ Target "DotnetRestore" (fun _ -> Target "DotnetBuild" (fun _ -> netcoreFiles |> Seq.iter (fun proj -> + let dir = Path.GetDirectoryName proj + dotnet dir "build" + + DotNetCli.Build (fun c -> { c with Project = proj