Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- TBD:Point to the actual release -->
<?define InfoURL="https://github.com/PowerShell/PowerShell" ?>
<?define ProductName = "$(env.ProductName)" ?>
<?define ProductGuid = "$(env.ProductGuid)" ?>
<?define ProductCode = "$(env.ProductCode)" ?>
<!-- UpgradeCode GUID MUST REMAIN SAME THROUGHOUT ALL VERSIONS, otherwise, updates won't occur. -->
Copy link
Member

@TravisEz13 TravisEz13 Jan 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually where the comment about SxS should be (in the comment about the UpgradeCode.)

<?if $(sys.BUILDARCH)=x64?>
<?define UpgradeCode = "31ab5147-9a97-4452-8443-d9709f0516e1" ?>
Expand All @@ -24,8 +24,8 @@
<!-- Explorer context submenu entries. The ampersand denotes the keyboard shortcut. -->
<?define ExplorerContextSubMenuDialogText = "Open &here"?>
<?define ExplorerContextSubMenuElevatedDialogText = "Open here as &Administrator"?>
<!-- The ProductCode is Product Id: http://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html -->
<Product Id="$(var.ProductGuid)" Name="$(var.ProductSemanticVersionWithName)-$(sys.BUILDARCH)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)">
<!-- The ProductCode is Product Id and needs to be unique for every PowerShell version to allow SxS install: http://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html -->
<Product Id="$(var.ProductCode)" Name="$(var.ProductSemanticVersionWithName)-$(sys.BUILDARCH)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)">
<!-- Properties About The Package -->
<Package Id="*" Keywords="Installer" Platform="$(sys.BUILDARCH)" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="PowerShell package" Comments="PowerShell for every system" />
<!-- Add PowerShell icon for executable -->
Expand Down
26 changes: 19 additions & 7 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2052,6 +2052,16 @@ function Get-PackageVersionAsMajorMinorBuildRevision
$packageVersion
}

<#
.Synopsis
Creates a Windows installer MSI package and assumes that the binaries are already built using 'Start-PSBuild'.
This only works on a Windows machine due to the usage of WiX.
.EXAMPLE
# This example shows how to produce a Debug-x64 installer for development purposes.
cd $RootPathOfPowerShellRepo
Import-Module .\build.psm1; Import-Module .\tools\packaging\packaging.psm1
New-MSIPackage -Verbose -ProductCode (New-Guid) -ProductSourcePath '.\src\powershell-win-core\bin\Debug\netcoreapp2.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3'
#>
function New-MSIPackage
{
[CmdletBinding()]
Expand All @@ -2069,9 +2079,10 @@ function New-MSIPackage
[ValidateNotNullOrEmpty()]
[string] $ProductVersion,

# Product Guid needs to change for every version to support SxS install
# The ProductCode property is a unique identifier for the particular product release
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $ProductGuid = 'a5249933-73a1-4b10-8a4c-13c98bdc16fe',
[string] $ProductCode,

# Source Path to the Product Files - required to package the contents into an MSI
[Parameter(Mandatory = $true)]
Expand All @@ -2080,17 +2091,18 @@ function New-MSIPackage

# File describing the MSI Package creation semantics
[ValidateNotNullOrEmpty()]
[ValidateScript( {Test-Path $_})]
[string] $ProductWxsPath = "$PSScriptRoot\assets\Product.wxs",

# Path to Assets folder containing artifacts such as icons, images
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $AssetsPath,
[ValidateScript( {Test-Path $_})]
[string] $AssetsPath = "$PSScriptRoot\assets",

# Path to license.rtf file - for the EULA
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $LicenseFilePath,
[ValidateScript( {Test-Path $_})]
[string] $LicenseFilePath = "$PSScriptRoot\assets\license.rtf",

# Architecture to use when creating the MSI
[Parameter(Mandatory = $true)]
Expand Down Expand Up @@ -2137,7 +2149,7 @@ function New-MSIPackage
[Environment]::SetEnvironmentVariable("ProductSourcePath", $ProductSourcePath, "Process")
# These variables are used by Product.wxs in assets directory
[Environment]::SetEnvironmentVariable("ProductName", $ProductName, "Process")
[Environment]::SetEnvironmentVariable("ProductGuid", $ProductGuid, "Process")
[Environment]::SetEnvironmentVariable("ProductCode", $ProductCode, "Process")
[Environment]::SetEnvironmentVariable("ProductVersion", $ProductVersion, "Process")
[Environment]::SetEnvironmentVariable("ProductSemanticVersion", $ProductSemanticVersion, "Process")
[Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process")
Expand Down
4 changes: 2 additions & 2 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ function Start-PSPackage {
ProductVersion = $Version
AssetsPath = "$PSScriptRoot\..\..\assets"
LicenseFilePath = "$PSScriptRoot\..\..\assets\license.rtf"
# Product Guid needs to be unique for every PowerShell version to allow SxS install
ProductGuid = New-Guid
# Product Code needs to be unique for every PowerShell version since it is a unique identifier for the particular product release
ProductCode = New-Guid
ProductTargetArchitecture = $TargetArchitecture
Force = $Force
}
Expand Down