Skip to content
This repository was archived by the owner on Nov 28, 2023. It is now read-only.

Commit 6120f22

Browse files
committed
build number
1 parent b641846 commit 6120f22

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

default.ps1

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ if((Get-Module | Where-Object {$_.Name -eq "psake"}) -eq $null)
44
$scriptPath = Split-Path $MyInvocation.InvocationName
55
Import-Module .\tools\psake.4.2.0.1\tools\psake.psm1
66
}
7-
7+
Import-Module .\tools\SetVersion.psm1
88
properties {
99
$configuration = "Release"
1010
$rootLocation = get-location
@@ -18,11 +18,12 @@ properties {
1818
$xunitRunner = ".\tools\xunit.runners.1.9.1\tools\xunit.console.clr4.exe"
1919
$nugetOutputDir = ".\ReleasePackages"
2020
$nugetExe = "$rootLocation\tools\nuget\nuget.exe"
21+
$versionFile = ".\MajorMinorVersion.txt"
2122
}
2223

2324
task Default -depends Pack
2425

25-
task Clean {
26+
task Clean -depends SetVersion {
2627
msbuild "$slnFile" /t:Clean /p:Configuration=$configuration
2728
}
2829

@@ -39,3 +40,20 @@ task Pack -depends Test {
3940
invoke-expression "& '$nugetExe' pack '$csprojFile' -Symbols -Properties Configuration=$configuration -OutputDirectory '$nugetOutputDir'"
4041
}
4142

43+
task SetVersion {
44+
$majorMinorVersion = Get-Content $versionFile
45+
46+
$buildNumber = $Env:BUILD_NUMBER
47+
48+
if([string]::IsNullOrEmpty($buildNumber))
49+
{
50+
$buildNumer = "*";
51+
}
52+
53+
$completeVersionNumber = $majorMinorVersion + "." + $buildNumer
54+
55+
write-host "Setting version to $completeVersionNumber"
56+
57+
Set-Version $completeVersionNumber
58+
}
59+

0 commit comments

Comments
 (0)