diff --git a/BuildTools/update-assemblyinfo.ps1 b/BuildTools/update-assemblyinfo.ps1 index ceb9bba11..d901e7fea 100644 --- a/BuildTools/update-assemblyinfo.ps1 +++ b/BuildTools/update-assemblyinfo.ps1 @@ -73,6 +73,12 @@ $templateFiles = ( @{Input="ILSpy/Properties/app.config.template"; Output = "ILSpy/app.config"}, @{Input="ILSpy.AddIn/source.extension.vsixmanifest.template"; Output = "ILSpy.AddIn/source.extension.vsixmanifest"} ); + +$appxmanifestFiles = ( + @{Input="ILSpy.Package/Package.appxmanifest"; Output="ILSpy.Package/Package.appxmanifest"}, + @{Input="ILSpy.Package/Package-CI.appxmanifest"; Output="ILSpy.Package/Package-CI.appxmanifest"} +); + [string]$mutexId = "ILSpyUpdateAssemblyInfo" + (Get-Location).ToString().GetHashCode(); Write-Host $mutexId; [bool]$createdNew = $false; @@ -144,6 +150,32 @@ try { $out | Out-File -Encoding utf8 $file.Output; } } + + # Only update these on the Build Agent when ReleaseChannel is set + if($Env:ReleaseChannel -ne '' -and $Env:ReleaseChannel -ne $null) { + foreach ($file in $appxmanifestFiles) { + [string]$in = (Get-Content $file.Input) -Join [System.Environment]::NewLine; + + $out = $in.Replace('$INSERTVERSION$', $fullVersionNumber); + $out = $out.Replace('$INSERTMAJORVERSION$', $major); + $out = $out.Replace('$INSERTMINORVERSION$', $minor); + $out = $out.Replace('$INSERTREVISION$', $revision); + $out = $out.Replace('$INSERTCOMMITHASH$', $gitCommitHash); + $out = $out.Replace('$INSERTSHORTCOMMITHASH$', $gitCommitHash.Substring(0, 8)); + $out = $out.Replace('$INSERTDATE$', [System.DateTime]::Now.ToString("MM/dd/yyyy")); + $out = $out.Replace('$INSERTYEAR$', [System.DateTime]::Now.Year.ToString()); + $out = $out.Replace('$INSERTBRANCHNAME$', $branchName); + $out = $out.Replace('$INSERTBRANCHPOSTFIX$', $postfixBranchName); + $out = $out.Replace('$INSERTVERSIONNAME$', $versionName); + $out = $out.Replace('$INSERTVERSIONNAMEPOSTFIX$', $postfixVersionName); + $out = $out.Replace('$INSERTBUILDCONFIG$', $buildConfig); + + if (((Get-Content $file.Input) -Join [System.Environment]::NewLine) -ne $out) { + $out | Out-File -Encoding utf8 $file.Output; + } + } + } + } finally { $mutex.ReleaseMutex(); $mutex.Close(); diff --git a/ILSpy.Package/Package-CI.appxmanifest b/ILSpy.Package/Package-CI.appxmanifest index 9edeeef3d..27b6e8f9f 100644 --- a/ILSpy.Package/Package-CI.appxmanifest +++ b/ILSpy.Package/Package-CI.appxmanifest @@ -11,7 +11,7 @@ + Version="$INSERTMAJORVERSION$.$INSERTMINORVERSION$.$INSERTREVISION$.0" /> ILSpy (CI) diff --git a/ILSpy.Package/Package.appxmanifest b/ILSpy.Package/Package.appxmanifest index ae775c493..cd8740c55 100644 --- a/ILSpy.Package/Package.appxmanifest +++ b/ILSpy.Package/Package.appxmanifest @@ -11,7 +11,7 @@ + Version="$INSERTMAJORVERSION$.$INSERTMINORVERSION$.$INSERTREVISION$.0" /> ILSpy diff --git a/ILSpy.WithPackage.sln b/ILSpy.WithPackage.sln index d6fdd5e0d..91d19a76e 100644 --- a/ILSpy.WithPackage.sln +++ b/ILSpy.WithPackage.sln @@ -38,6 +38,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{58AA7BDB-174C-4566-BD8A-EC461F1D6848}" ProjectSection(SolutionItems) = preProject azure-pipelines.yml = azure-pipelines.yml + BuildTools\update-assemblyinfo.ps1 = BuildTools\update-assemblyinfo.ps1 EndProjectSection EndProject Global