Skip to content

Commit 2d5ebe3

Browse files
Gencebay DemirGencebay Demir
authored andcommitted
Assembly versioning added
1 parent e1e59e6 commit 2d5ebe3

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

AssemblyVersioning.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
param (
2+
[Parameter(Mandatory=$True)]
3+
[string]$rootDir,
4+
[Parameter(Mandatory=$True)]
5+
[string]$fileNamePattern,
6+
[Parameter(Mandatory=$True)]
7+
[string]$major,
8+
[Parameter(Mandatory=$True)]
9+
[string]$minor
10+
)
11+
12+
Write-Verbose 'Entering assemblyversioning.ps1'
13+
14+
### First, mount the assembly version ###
15+
16+
#Calculate today's julian date
17+
18+
function Get-JulianDate {
19+
#Calculate today's julian date
20+
$Year = get-date -format yy
21+
$JulianYear = $Year.Substring(1)
22+
$DayOfYear = (Get-Date).DayofYear
23+
$JulianDate = $JulianYear + "{0:D3}" -f $DayOfYear
24+
$JulianDate
25+
return
26+
}
27+
28+
$build = Get-JulianDate
29+
30+
$buildNumberFromVso = $($env:BUILD_BUILDNUMBER)
31+
32+
$revision = $buildNumberFromVso.Split(".")[1]
33+
34+
# The Assembly Version
35+
36+
$assemblyVersion = "$major.$minor.$build.$revision"
37+
38+
Write-Host "The version this build will generate is $assemblyVersion"
39+
40+
$assemblyVersionString = "AssemblyVersion(""$assemblyVersion"")"
41+
$assemblyFileVersionString = "AssemblyFileVersion(""$assemblyVersion"")"
42+
43+
$assemblyInfoFiles = Get-ChildItem -Path $rootDir -Filter $fileNamePattern -Recurse
44+
$fileCount = $assemblyInfoFiles.Count
45+
46+
Write-Host ""
47+
Write-Host "Started writing the $fileNamePattern files..."
48+
Write-Host ""
49+
50+
foreach($file in $assemblyInfoFiles){
51+
$fullFilePath = Join-Path $file.Directory $file.Name
52+
53+
Write-Host "Editing $fullFilePath"
54+
55+
Add-Content -Path $fullFilePath -Value "`n[assembly: $assemblyVersionString]"
56+
Add-Content -Path $fullFilePath -Value "[assembly: $assemblyFileVersionString]"
57+
}
58+
59+
Write-Host ""
60+
Write-Host "Finished editing $fileCount AssemblyInfo files."

appveyor.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ init:
33
branches:
44
only:
55
- master
6-
- release
7-
- dev
8-
- /^(.*\/)?ci-.*$/
6+
artifacts:
7+
- path: artifacts\build\*.nupkg
98
build_script:
109
- build.cmd --quiet verify
1110
clone_depth: 1

0 commit comments

Comments
 (0)