Skip to content

Commit 657299b

Browse files
committed
.build/runbuild.ps1: use Exec to ensure build fails if a command fails
1 parent 3fc9079 commit 657299b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.build/runbuild.ps1

+13-7
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ task Compile -depends Clean, Init -description "This task compiles the solution"
7777
-fileVersion $version `
7878
-file $common_assembly_info
7979

80-
&dotnet msbuild $solutionFile /t:Build `
81-
/p:Configuration=$configuration `
82-
/p:InformationalVersion=$pv `
83-
/p:Company=$company_name `
84-
/p:Copyright=$copyright
80+
Exec {
81+
&dotnet msbuild $solutionFile /t:Build `
82+
/p:Configuration=$configuration `
83+
/p:InformationalVersion=$pv `
84+
/p:Company=$company_name `
85+
/p:Copyright=$copyright
86+
}
8587
} finally {
8688
Restore-File $common_assembly_info
8789
}
@@ -105,7 +107,9 @@ task Pack -depends Compile -description "This task creates the NuGet packages" {
105107

106108
foreach ($package in $packages) {
107109
Write-Host "Creating NuGet package for $package..." -ForegroundColor Magenta
108-
&dotnet pack $package --output $nuget_package_directory --configuration $configuration --no-build --version-suffix $packageVersion
110+
Exec {
111+
&dotnet pack $package --output $nuget_package_directory --configuration $configuration --no-build --version-suffix $packageVersion
112+
}
109113
}
110114
} finally {
111115
Restore-File $versionFile
@@ -121,7 +125,9 @@ task Test -depends Pack -description "This task runs the tests" {
121125
foreach ($framework in $frameworks) {
122126
Write-Host "Running tests for framework: $framework" -ForegroundColor Green
123127

124-
&dotnet test $testProject --configuration $configuration --framework $framework.Trim() --no-build
128+
Exec {
129+
&dotnet test $testProject --configuration $configuration --framework $framework.Trim() --no-build
130+
}
125131
}
126132
}
127133

0 commit comments

Comments
 (0)