-
Notifications
You must be signed in to change notification settings - Fork 8
/
Build.ps1
36 lines (29 loc) · 1.63 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
Push-Location $PSScriptRoot
$nuget_path = (join-path (join-path $env:LOCALAPPDATA "Nuget") "nuget.exe")
if ((test-path (join-path $env:LOCALAPPDATA "Nuget")) -eq $false) {
New-Item -Path (join-path $env:LOCALAPPDATA "Nuget") -ItemType Directory | Out-Null
}
if ((test-path $nuget_path) -eq $false -or [System.Version](Get-Item $nuget_path).VersionInfo.FileVersion -lt [System.Version]"3.4.4") {
try {
Invoke-WebRequest "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" -OutFile $nuget_path
} catch [System.Net.WebException] {
Write-Error "Could not access nuget.org, aborting."
exit 1
}
}
if ((test-path .\packages\vswhere\tools\vswhere.exe -ErrorAction SilentlyContinue) -eq $false) {
$nuget_params = 'install', 'vswhere', '-ExcludeVersion', '-OutputDirectory', 'packages'
& $nuget_path $nuget_params
}
$ids = 'Community', 'Professional', 'Enterprise', 'BuildTools' | foreach { 'Microsoft.VisualStudio.Product.' + $_ }
$instance = .\packages\vswhere\tools\vswhere.exe -latest -products $ids -requires 'Microsoft.Component.MSBuild' -format json `
| convertfrom-json `
| select-object -first 1
$msbuild = join-path $instance.installationPath 'MSBuild\15.0\Bin\MSBuild.exe'
if ((test-path $msbuild) -eq $false) {
Write-Error "Could not find msbuild."
exit 2
}
&$msbuild Cassette\Cassette.csproj /t:Build,Pack /p:Configuration=Release /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=..\artifacts
&$msbuild Cassette.Types\Cassette.Types.csproj /t:Build,Pack /p:Configuration=Release /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=..\artifacts
Pop-Location