forked from microsoft/service-fabric-aspnetcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
68 lines (54 loc) · 2.02 KB
/
build.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
##
# Builds the source code and generates nuget packages. You can optionally just build the source code by opening individual solutions in Visual Studio.
##
param
(
# Configuration to build.
[ValidateSet('Debug', 'Release')]
[string]$configuration = "Release",
# target to build.
#Options are:
# RebuildAll: Clean, Build all .csproj and Generate Nuget Packages. This is the default option.
# BuildAll: Build all .csproj and Generate Nuget Packages.
# GeneratePackages: Build all product .csprojs and generate nuget packages.
# BuildTests: Builds all test .csprojs.
# BuildProduct: Builds all product .csprojs.
[ValidateSet('Rebuildall', 'BuildAll', 'GeneratePackages', 'BuildTests', 'BuildProduct')]
[string]$target = "RebuildAll",
# msbuild verbosity level.
[ValidateSet('quiet','minimal', 'normal', 'detailed', 'diagnostic')]
[string]$verbosity = 'minimal'
)
# Check msbuild exists
$msbuildPath = "MSBuild\14.0\bin\MSBuild.exe"
if (Test-Path "env:\ProgramFiles(x86)")
{
$progFilesPath = ${env:ProgramFiles(x86)}
}
elseif (Test-Path "env:\ProgramFiles")
{
$progFilesPath = ${env:ProgramFiles}
}
$msbuildFullPath = join-path $progFilesPath $msbuildPath
if (!(Test-Path $msbuildFullPath))
{
# Find msbuild for VS2017
$VS2017InstallPath = join-path $progFilesPath "Microsoft Visual Studio\2017"
$versions = 'Community', 'Professional', 'Enterprise'
foreach ($version in $versions)
{
$VS2017VersionPath = join-path $VS2017InstallPath $version
$msbuildFullPath = join-path $VS2017VersionPath "MSBuild\15.0\Bin\MSBuild.exe"
if (Test-Path $msbuildFullPath)
{
break
}
}
if (!(Test-Path $msbuildFullPath))
{
throw "Unable to find MSBuild installed on this machine. Please install it (or install Visual Studio 2015/2017.)"
}
}
Write-Output "Using msbuild from $msbuildFullPath"
$msbuildArgs = @("buildall.proj", "/nr:false", "/nologo", "/t:$target", "/verbosity:$verbosity", "/property:RequestedVerbosity=$verbosity", "/property:Configuration=$configuration", $args)
& $msbuildFullPath $msbuildArgs