-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathgen-ver.ps1
More file actions
8 lines (8 loc) · 840 Bytes
/
gen-ver.ps1
File metadata and controls
8 lines (8 loc) · 840 Bytes
1
2
3
4
5
6
7
8
$majorVersion=1
$minorVersion=1
$version="$majorVersion.$minorVersion"+"."+(Get-Date -Format yy)+(Get-Date).DayOfYear+"."+(Get-Date -Format HHmm)
$csproj="Ntreev.Library.Psd\Ntreev.Library.Psd.csproj"
$assemblyInfo = "Ntreev.Library.Psd.AssemblyInfo\AssemblyInfo.cs"
Set-Content version.txt $version
(Get-Content $csproj) -replace "(<Version>)(.*)(</Version>)", "`${1}$version`$3" -replace "(<FileVersion>)(.*)(</FileVersion>)", "`${1}$version`$3" -replace "(<AssemblyVersion>)(.*)(</AssemblyVersion>)", "`${1}$majorVersion.$minorVersion.0.0`$3" | Set-Content $csproj
(Get-Content $assemblyInfo) -replace "(AssemblyVersion[(]`").+(`"[)]])", "`${1}$version`$2" -replace "(AssemblyFileVersion[(]`").+(`"[)]])", "`${1}$fileVersion`$2" -replace "(AssemblyInformationalVersion[(]`").+(`"[)]])", "`${1}$fileVersion`$2" | Set-Content $assemblyInfo