/
BuildRelease.ps1
36 lines (25 loc) · 1.13 KB
/
BuildRelease.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
function Get-VsVersion ()
{
if ($env:VS140COMNTOOLS -ne $null)
{
" /property:VisualStudioVersion=14.0"
}
elseif ($env:VS120COMNTOOLS -ne $null)
{
" /property:VisualStudioVersion=12.0"
}
}
function Get-BuildConfiguration()
{
$env:config='Release';
" /p:Configuration={0}" -f $env:config
}
function Get-CurrentPackageVersion($pathToAssembly)
{
[System.Diagnostics.FileVersionInfo]$fv=[System.Diagnostics.FileVersionInfo]::GetVersionInfo($pathToAssembly)
"{0}.{1}.{2}" -f ($fv.FileMajorPart,$fv.FileMinorPart,$fv.FileBuildPart)
}
$env:nuget="nuget"
Start-Process -NoNewWindow -Wait -FilePath ${Env:ProgramFiles(x86)}\MSBuild\14.0\Bin\MSBuild -ArgumentList ('src\SimpleAD\SimpleAD.csproj', (Get-VsVersion),(Get-BuildConfiguration))
$env:version=Get-CurrentPackageVersion (Resolve-Path -Path (".\src\SimpleAD\bin\{0}\SimpleAD.dll" -f $env:config) -Relative)
Start-Process -NoNewWindow -Wait -FilePath $env:nuget -ArgumentList ('pack','NugetSpecs\SimpleAD.nuspec', ' -NoPackageAnalysis', ' -verbosity detailed',' -o Build', ('-Version {0}' -f $env:version),' -p',('Configuration={0}' -f $env:config))