Skip to content

Commit e051748

Browse files
authored
Make the AssemblyVersion not change for servicing releases (PowerShell#24667)
1 parent 93d85f1 commit e051748

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.pipelines/templates/nupkg.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ jobs:
120120
$refAssemblyFolder = Join-Path '$(System.ArtifactsDirectory)' 'RefAssembly'
121121
$null = New-Item -Path $refAssemblyFolder -Force -Verbose -Type Directory
122122
123-
Start-PSBuild -Clean -Runtime linux-x64 -Configuration Release
123+
Start-PSBuild -Clean -Runtime linux-x64 -Configuration Release -ReleaseTag $(ReleaseTagVar)
124124
125125
$sharedModules | Foreach-Object {
126126
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net9.0\refint\$_.dll"
@@ -136,7 +136,7 @@ jobs:
136136
}
137137
}
138138
139-
Start-PSBuild -Clean -Runtime win7-x64 -Configuration Release
139+
Start-PSBuild -Clean -Runtime win7-x64 -Configuration Release -ReleaseTag $(ReleaseTagVar)
140140
141141
$winOnlyModules | Foreach-Object {
142142
$refFile = Get-ChildItem -Path "$(PowerShellRoot)\src\$_\obj\Release\net9.0\refint\*.dll"

PowerShell.Common.props

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@
5858
<PSCoreFileVersion Condition = "'$(ReleaseTagSemVersionPart)' != ''">$(ReleaseTagVersionPart).$(ReleaseTagSemVersionPart)</PSCoreFileVersion>
5959
<!-- Create the version if we have a release build -->
6060
<PSCoreFileVersion Condition = "'$(PSCoreFileVersion)' == ''">$(ReleaseTagVersionPart).$(GAIncrementValue)</PSCoreFileVersion>
61+
<!-- Set 'FileVersion' and 'AssemblyVersion' explicitly:
62+
- make 'FileVersion' the same as 'PSCoreFileVersion'
63+
- make 'AssemblyVersion' be the 'PSCoreFileVersion' with the 'Build' field set to 0, so the assembly version doesn't change for servicing releases -->
64+
<FileVersion>$(PSCoreFileVersion)</FileVersion>
65+
<AssemblyVersion>$([System.Version]::Parse($(PSCoreFileVersion)).Major).$([System.Version]::Parse($(PSCoreFileVersion)).Minor).0.$([System.Version]::Parse($(PSCoreFileVersion)).Revision)</AssemblyVersion>
6166
</PropertyGroup>
6267

6368
<PropertyGroup>
@@ -84,7 +89,7 @@
8489
-->
8590

8691
<!--
87-
Here we define explicitly 'Version' to set 'FileVersion' and 'AssemblyVersion' by 'GetAssemblyVersion' target in 'Microsoft.NET.GenerateAssemblyInfo.targets'.
92+
Here we define explicitly 'Version' to set 'FileVersion' and 'AssemblyVersion' when they are not explicitly set.
8893
Here we define explicitly 'InformationalVersion' because by default it is defined as 'Version' by 'GetAssemblyVersion' target in 'Microsoft.NET.GenerateAssemblyInfo.targets'.
8994
-->
9095
<Version>$(PSCoreFileVersion)</Version>

0 commit comments

Comments
 (0)