Skip to content

Commit 37f2dd1

Browse files
authored
Simply the way to get semantic version information in build (#1324)
1 parent fbd5dbc commit 37f2dd1

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

PSReadLine.build.ps1

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,24 +169,10 @@ task LayoutModule BuildMainModule, BuildMamlHelp, {
169169
}
170170

171171
# Copy module manifest, but fix the version to match what we've specified in the binary module.
172-
$version = (Get-ChildItem -Path $targetDir/Microsoft.PowerShell.PSReadLine2.dll).VersionInfo.FileVersion
173172
$moduleManifestContent = ConvertTo-CRLF (Get-Content -Path 'PSReadLine/PSReadLine.psd1' -Raw)
174-
175-
$getContentArgs = @{
176-
Raw = $true;
177-
Path = "./bin/$Configuration/PSReadLine/Microsoft.PowerShell.PSReadLine2.dll"
178-
}
179-
if ($PSVersionTable.PSEdition -eq 'Core')
180-
{
181-
$getContentArgs += @{AsByteStream = $true}
182-
}
183-
else
184-
{
185-
$getContentArgs += @{Encoding = "Byte"}
186-
}
187-
$b = Get-Content @getContentArgs
188-
$a = [System.Reflection.Assembly]::Load($b)
189-
$semVer = ($a.GetCustomAttributes([System.Reflection.AssemblyInformationalVersionAttribute], $false)).InformationalVersion
173+
$versionInfo = (Get-ChildItem -Path $targetDir/Microsoft.PowerShell.PSReadLine2.dll).VersionInfo
174+
$version = $versionInfo.FileVersion
175+
$semVer = $versionInfo.ProductVersion
190176

191177
if ($semVer -match "(.*)-(.*)")
192178
{

0 commit comments

Comments
 (0)