Merge pull request #1212 from PowerShell/RaghuS-MSIInstallerEnhancements

MSI Installer enhancements Part 1
This commit is contained in:
Andy Schwartzmeyer 2016-06-27 15:26:55 -07:00 committed by GitHub
commit 02abcf5948
3 changed files with 41 additions and 17 deletions

BIN
assets/Powershell_256.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

View file

@ -14,9 +14,15 @@
<!-- Generate Your Own GUID for both ID and UpgradeCode attributes. -->
<!-- Note: UpgradeCode GUID MUST REMAIN SAME THROUGHOUT ALL VERSIONS -->
<!-- Otherwise, updates wont occur -->
<Product Id="$(var.ProductGuid)" Name="$(var.ProductVersionWithName)" Language="1033" Version="0.1.0.0" Manufacturer="Microsoft Corporation" UpgradeCode="{f7ba3e58-0be8-443b-ac91-f99dd1e7bd3b}">
<Product Id="$(var.ProductGuid)" Name="$(var.ProductVersionWithName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Microsoft Corporation" UpgradeCode="{f7ba3e58-0be8-443b-ac91-f99dd1e7bd3b}">
<!-- Properties About The Package -->
<Package Id="*" Keywords="Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="OpenPowerShell package" Comments="OpenPowerShell" />
<Package Id="*" Keywords="Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Description="PowerShell package" Comments="PowerShell for every system" />
<!-- Add PowerShell icon for executable -->
<Icon Id="PowerShellExe.ico" SourceFile="assets\Powershell_256.ico" />
<!-- Add PowerShell icon in Add/Remove Programs -->
<Property Id="ARPPRODUCTICON" Value="PowerShellExe.ico" />
<!-- Set properties for add/remove programs -->
<Property Id="ARPHELPLINK" Value="$(var.InfoURL)" />
@ -25,7 +31,7 @@
<Condition Message="Supported only on Win7SP1 or later"><![CDATA[ Installed OR $(var.Win7SP1OrLater) ]]></Condition>
<!-- Information About When Older Versions Are Trying To Be Installed-->
<MajorUpgrade DowngradeErrorMessage="A newer version of OpenPowerShell is already installed." />
<MajorUpgrade DowngradeErrorMessage="A newer version of PowerShell is already installed." />
<!-- Embed Cabinet Files in Product-->
<MediaTemplate EmbedCab="yes" />
@ -37,7 +43,7 @@
<UIRef Id="WixUI_Minimal" />
<!-- Features are mandatory. Need At Least One. -->
<Feature Id="ProductFeature" Title="OpenPowerShell" Level="1">
<Feature Id="ProductFeature" Title="PowerShell" Level="1">
<ComponentGroupRef Id="$(var.ProductVersionWithName)"/>
<ComponentRef Id="ProductVersionFolder"/>
<ComponentRef Id="ApplicationProgramsMenuShortcut"/>
@ -48,7 +54,7 @@
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="OpenPowerShell">
<Directory Id="INSTALLFOLDER" Name="PowerShell">
<Directory Id="$(var.ProductVersionWithName)" Name="$(var.ProductVersion)">
<Component Id="ProductVersionFolder" Guid="{e1a7f05e-0cd6-4227-80a8-e4fb311f045c}">
<CreateFolder/>
@ -59,11 +65,12 @@
<Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductVersionWithName)">
<Component Id="ApplicationProgramsMenuShortcut" Guid="{A77507A7-F970-4618-AC30-20AFE36EE2EB}">
<Shortcut Id="OpenPowerShell_ProgramsMenuShortcut"
<Shortcut Id="PowerShell_ProgramsMenuShortcut"
Name="$(var.ProductVersionWithName)"
Description="$(var.ProductVersionWithName)"
Target="[$(var.ProductVersionWithName)]PowerShell.exe"
WorkingDirectory="$(var.ProductVersionWithName)"/>
WorkingDirectory="$(var.ProductVersionWithName)"
Icon = "PowerShellExe.ico" />
<RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>

View file

@ -504,7 +504,7 @@ Built upon .NET Core, it is also a C# REPL.
Write-Verbose "Packaging $Source"
if ($IsWindows) {
$msiPackagePath = New-MSIPackage -ProductSourcePath $Source -ProductVersion $Version -Verbose
$msiPackagePath = New-MSIPackage -ProductSourcePath $Source -ProductVersion $Version -AssetsPath "$PSScriptRoot\Assets" -Verbose
$appxPackagePath = New-AppxPackage -PackageVersion $Version -SourcePath $Source -AssetsPath "$PSScriptRoot\Assets" -Verbose
$packages = @($msiPackagePath, $appxPackagePath)
@ -1348,7 +1348,7 @@ function New-MSIPackage
# Name of the Product
[ValidateNotNullOrEmpty()]
[string] $ProductName = 'OpenPowerShell',
[string] $ProductName = 'PowerShell',
# Version of the Product
[Parameter(Mandatory = $true)]
@ -1366,7 +1366,12 @@ function New-MSIPackage
# File describing the MSI Package creation semantics
[ValidateNotNullOrEmpty()]
[string] $ProductWxsPath = (Join-Path $pwd '\assets\Product.wxs')
[string] $ProductWxsPath = (Join-Path $pwd '\assets\Product.wxs'),
# Path to Assets folder containing artifacts such as icons, images
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[string] $AssetsPath
)
@ -1382,9 +1387,21 @@ function New-MSIPackage
$wixHeatExePath = Join-Path $wixToolsetBinPath "Heat.exe"
$wixCandleExePath = Join-Path $wixToolsetBinPath "Candle.exe"
$wixLightExePath = Join-Path $wixToolsetBinPath "Light.exe"
Write-Verbose "Extract the version in the form of a.b.c.d for $ProductVersion"
$ProductVersionTokens = $ProductVersion.Split('-')
$ProductVersion = ([regex]::matches($ProductVersion, "\d+(\.\d+)+"))[0].value
# Need to add the last version field for makeappx
$ProductVersion = $ProductVersion + '.' + $ProductVersionTokens[1]
# Wix tooling does not like hyphen in the foldername
$ProductVersion = $ProductVersion.Replace('-', '_')
$assetsInSourcePath = "$ProductSourcePath" + '\assets'
New-Item $assetsInSourcePath -type directory -Force | Write-Verbose
$assetsInSourcePath = Join-Path $ProductSourcePath 'assets'
Write-Verbose "Place dependencies such as icons to $assetsInSourcePath"
Copy-Item "$AssetsPath\*.ico" $assetsInSourcePath -Force
$productVersionWithName = $ProductName + "_" + $ProductVersion
Write-Verbose "Create MSI for Product $productVersionWithName"
@ -1420,7 +1437,7 @@ function New-AppxPackage
# Name of the Package
[ValidateNotNullOrEmpty()]
[string] $PackageName = 'OpenPowerShell',
[string] $PackageName = 'PowerShell',
# Version of the Package
[Parameter(Mandatory = $true)]
@ -1471,9 +1488,9 @@ function New-AppxPackage
$appxManifest = @"
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities">
<Identity Name="Microsoft.OpenPowerShell" ProcessorArchitecture="x64" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="#VERSION#" />
<Identity Name="Microsoft.PowerShell" ProcessorArchitecture="x64" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="#VERSION#" />
<Properties>
<DisplayName>OpenPowerShell</DisplayName>
<DisplayName>PowerShell</DisplayName>
<PublisherDisplayName>Microsoft Corporation</PublisherDisplayName>
<Logo>#LOGO#</Logo>
</Properties>
@ -1488,8 +1505,8 @@ function New-AppxPackage
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="OpenPowerShell" Executable="powershell.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="OpenPowerShell" Description="OpenPowerShell Package" BackgroundColor="transparent" Square150x150Logo="#SQUARE150x150LOGO#" Square44x44Logo="#SQUARE44x44LOGO#">
<Application Id="PowerShell" Executable="powershell.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="PowerShell" Description="PowerShell for every system" BackgroundColor="transparent" Square150x150Logo="#SQUARE150x150LOGO#" Square44x44Logo="#SQUARE44x44LOGO#">
</uap:VisualElements>
</Application>
</Applications>