Use Product Semantic version in the MSI installer where possible (#3435)

This commit is contained in:
Raghu Shantha [MSFT]
2017-03-29 13:36:44 -07:00
committed by Dongbo Wang
parent 39be7109d4
commit d2d80c6832
2 changed files with 14 additions and 11 deletions
+8 -6
View File
@@ -10,14 +10,16 @@
<?define ProductName = "$(env.ProductName)" ?>
<?define ProductGuid = "$(env.ProductGuid)" ?>
<?define ProductVersion = "$(env.ProductVersion)" ?>
<?define ProductSemanticVersion = "$(env.ProductSemanticVersion)" ?>
<?define ProductVersionWithName = "$(var.ProductName)_$(var.ProductVersion)"?>
<?define ProductSemanticVersionWithName = "$(var.ProductName)-$(env.ProductSemanticVersion)"?>
<?define ProductTargetArchitecture = "$(env.ProductTargetArchitecture)"?>
<?define ProductProgFilesDir = "$(env.ProductProgFilesDir)" ?>
<!-- Generate Your Own GUID for both ID and UpgradeCode attributes. -->
<!-- Note: UpgradeCode GUID MUST REMAIN SAME THROUGHOUT ALL VERSIONS -->
<!-- Otherwise, updates won't occur -->
<Product Id="$(var.ProductGuid)" Name="$(var.ProductVersionWithName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="{f7ba3e58-0be8-443b-ac91-f99dd1e7bd3b}">
<Product Id="$(var.ProductGuid)" Name="$(var.ProductSemanticVersionWithName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="{f7ba3e58-0be8-443b-ac91-f99dd1e7bd3b}">
<!-- Properties About The Package -->
<Package Id="*" Keywords="Installer" Platform="$(var.ProductTargetArchitecture)" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="PowerShell package" Comments="PowerShell for every system" />
@@ -55,7 +57,7 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.ProductProgFilesDir)">
<Directory Id="INSTALLFOLDER" Name="PowerShell">
<Directory Id="$(var.ProductVersionWithName)" Name="$(var.ProductVersion)">
<Directory Id="$(var.ProductVersionWithName)" Name="$(var.ProductSemanticVersion)">
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
<CreateFolder/>
</Component>
@@ -63,11 +65,11 @@
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductVersionWithName)">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductSemanticVersionWithName)">
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
<Shortcut Id="PowerShell_ProgramsMenuShortcut"
Name="$(var.ProductVersionWithName)"
Description="$(var.ProductVersionWithName)"
Name="$(var.ProductSemanticVersionWithName)"
Description="$(var.ProductSemanticVersionWithName)"
Target="[$(var.ProductVersionWithName)]PowerShell.exe"
WorkingDirectory="$(var.ProductVersionWithName)"
Icon = "PowerShellExe.ico" />
@@ -75,7 +77,7 @@
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
<RegistryValue Root="HKCU"
Key="Software\Microsoft\$(var.ProductVersionWithName)\ProgramsMenuShortcut"
Key="Software\Microsoft\$(var.ProductSemanticVersionWithName)\ProgramsMenuShortcut"
Name="installed"
Type="integer"
Value="1" KeyPath="yes"/>
+6 -5
View File
@@ -2490,8 +2490,8 @@ function New-MSIPackage
Write-Verbose "Place dependencies such as icons to $assetsInSourcePath"
Copy-Item "$AssetsPath\*.ico" $assetsInSourcePath -Force
$productVersionWithName = $ProductName + "_" + $ProductVersion
$productSemanticVersionWithName = $ProductName + "_" + $ProductSemanticVersion
$productVersionWithName = $ProductName + '_' + $ProductVersion
$productSemanticVersionWithName = $ProductName + '-' + $ProductSemanticVersion
Write-Verbose "Create MSI for Product $productSemanticVersionWithName"
@@ -2500,7 +2500,8 @@ function New-MSIPackage
[Environment]::SetEnvironmentVariable("ProductName", $ProductName, "Process")
[Environment]::SetEnvironmentVariable("ProductGuid", $ProductGuid, "Process")
[Environment]::SetEnvironmentVariable("ProductVersion", $ProductVersion, "Process")
[Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process")
[Environment]::SetEnvironmentVariable("ProductSemanticVersion", $ProductSemanticVersion, "Process")
[Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process")
[Environment]::SetEnvironmentVariable("ProductTargetArchitecture", $ProductTargetArchitecture, "Process")
$ProductProgFilesDir = "ProgramFiles64Folder"
if ($ProductTargetArchitecture -eq "x86")
@@ -2625,7 +2626,7 @@ function New-AppxPackage
Write-Verbose "Place AppxManifest dependencies such as images to $assetsInSourcePath"
Copy-Item "$AssetsPath\*.png" $assetsInSourcePath -Force
$appxPackageName = $PackageName + "_" + $PackageSemanticVersion
$appxPackageName = $PackageName + "-" + $PackageSemanticVersion
if ($PackageNameSuffix) {
$appxPackageName = $appxPackageName, $PackageNameSuffix -join "-"
}
@@ -2667,7 +2668,7 @@ function New-ZipPackage
$ProductSemanticVersion = Get-PackageSemanticVersion -Version $PackageVersion
$zipPackageName = $PackageName + "_" + $ProductSemanticVersion
$zipPackageName = $PackageName + "-" + $ProductSemanticVersion
if ($PackageNameSuffix) {
$zipPackageName = $zipPackageName, $PackageNameSuffix -join "-"
}