forked from aliencube/Microsoft-ADAL-Wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-solution.ps1
39 lines (30 loc) · 893 Bytes
/
build-solution.ps1
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
35
36
37
38
39
# This script runs solution build.
Param(
[string] [Parameter(Mandatory=$false)] $Configuration = "Debug"
)
# Restores NuGet packages
Write-Host "Restoring NuGet packages ..." -ForegroundColor Green
dotnet restore
Write-Host "NuGet packages restored" -ForegroundColor Green
# Builds each project
$exitCode = 0
$projects = Get-ChildItem .\src, .\test | ?{$_.PsIsContainer}
foreach($project in $projects)
{
$projectPath = $project.FullName
$projectName = $project.Name
Write-Host "Building $projectName with $Configuration settings ..." -ForegroundColor Green
dotnet build $projectPath --configuration $Configuration
if ($LASTEXITCODE -ne 0)
{
Write-Host "Building $projectName failure" -ForegroundColor Red
}
else
{
Write-Host "Building $projectName success" -ForegroundColor Green
}
$exitCode += $LASTEXITCODE
}
if($exitCode -ne 0) {
$host.SetShouldExit($exitCode)
}