@@ -784,10 +784,13 @@ Built upon .NET Core, it is also a C# REPL.
784784 $Source = Split-Path - Parent (Get-PSOutput - Options (New-PSOptions - Publish))
785785 Write-Verbose " Packaging $Source "
786786
787+ Write-Verbose " Copy license and third party notice to $Source "
788+ Copy-Item " $PSScriptRoot \LICENSE.txt" " $Source " - Force - ErrorAction SilentlyContinue
789+
787790 if ($IsWindows ) {
788791 # Product Guid needs to be unique for every PowerShell version to allow SxS install
789792 $productGuid = [guid ]::NewGuid()
790- $msiPackagePath = New-MSIPackage - ProductSourcePath $Source - ProductVersion $Version - AssetsPath " $PSScriptRoot \Assets " - ProductGuid $productGuid
793+ $msiPackagePath = New-MSIPackage - ProductSourcePath $Source - ProductVersion $Version - AssetsPath " $PSScriptRoot \assets " - LicenseFilePath " $PSScriptRoot \assets\license.rtf " - ProductGuid $productGuid
791794 $appxPackagePath = New-AppxPackage - PackageVersion $Version - SourcePath $Source - AssetsPath " $PSScriptRoot \Assets"
792795
793796 $packages = @ ($msiPackagePath , $appxPackagePath )
@@ -1526,9 +1529,10 @@ function New-MSIPackage
15261529{
15271530 [CmdletBinding ()]
15281531 param (
1532+
15291533 # Name of the Product
15301534 [ValidateNotNullOrEmpty ()]
1531- [string ] $ProductName = ' PowerShell' ,
1535+ [string ] $ProductName = ' PowerShell' ,
15321536
15331537 # Version of the Product
15341538 [Parameter (Mandatory = $true )]
@@ -1551,14 +1555,20 @@ function New-MSIPackage
15511555 # Path to Assets folder containing artifacts such as icons, images
15521556 [Parameter (Mandatory = $true )]
15531557 [ValidateNotNullOrEmpty ()]
1554- [string ] $AssetsPath
1558+ [string ] $AssetsPath ,
15551559
1556- )
1560+ # Path to license.rtf file - for the EULA
1561+ [Parameter (Mandatory = $true )]
1562+ [ValidateNotNullOrEmpty ()]
1563+ [string ] $LicenseFilePath
1564+
1565+ )
15571566
15581567 $wixToolsetBinPath = " ${env: ProgramFiles(x86)} \WiX Toolset v3.10\bin"
15591568
15601569 Write-Verbose " Ensure Wix Toolset is present on the machine @ $wixToolsetBinPath "
1561- if (-not (Test-Path $wixToolsetBinPath )) {
1570+ if (-not (Test-Path $wixToolsetBinPath ))
1571+ {
15621572 throw " Install Wix Toolset prior to running this script - https://wix.codeplex.com/downloads/get/1540240"
15631573 }
15641574
@@ -1568,15 +1578,15 @@ function New-MSIPackage
15681578 $wixLightExePath = Join-Path $wixToolsetBinPath " Light.exe"
15691579
15701580 $ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision - Version $ProductVersion - Verbose
1571-
1581+
15721582 $assetsInSourcePath = " $ProductSourcePath " + ' \assets'
15731583 New-Item $assetsInSourcePath - type directory - Force | Write-Verbose
15741584
15751585 $assetsInSourcePath = Join-Path $ProductSourcePath ' assets'
15761586
1577- Write-Verbose " Place dependencies such as icons to $assetsInSourcePath "
1587+ Write-Verbose " Place dependencies such as icons to $assetsInSourcePath "
15781588 Copy-Item " $AssetsPath \*.ico" $assetsInSourcePath - Force
1579-
1589+
15801590 $productVersionWithName = $ProductName + " _" + $ProductVersion
15811591 Write-Verbose " Create MSI for Product $productVersionWithName "
15821592
@@ -1589,14 +1599,14 @@ function New-MSIPackage
15891599 $wixFragmentPath = (Join-path $env: Temp " Fragment.wxs" )
15901600 $wixObjProductPath = (Join-path $env: Temp " Product.wixobj" )
15911601 $wixObjFragmentPath = (Join-path $env: Temp " Fragment.wixobj" )
1592-
1593- $msiLocationPath = Join-Path $pwd " $productVersionWithName .msi"
1602+
1603+ $msiLocationPath = Join-Path $pwd " $productVersionWithName .msi"
15941604 Remove-Item - ErrorAction SilentlyContinue $msiLocationPath - Force
15951605
15961606 & $wixHeatExePath dir $ProductSourcePath - dr $productVersionWithName - cg $productVersionWithName - gg - sfrag - srd - scom - sreg - out $wixFragmentPath - var env.ProductSourcePath - v | Write-Verbose
15971607 & $wixCandleExePath " $ProductWxsPath " " $wixFragmentPath " - out (Join-Path " $env: Temp " " \\" ) - arch x64 - v | Write-Verbose
1598- & $wixLightExePath - out " $productVersionWithName .msi" $wixObjProductPath $wixObjFragmentPath - ext WixUIExtension - v | Write-Verbose
1599-
1608+ & $wixLightExePath - out " $productVersionWithName .msi" $wixObjProductPath $wixObjFragmentPath - ext WixUIExtension - dWixUILicenseRtf = " $LicenseFilePath " - v | Write-Verbose
1609+
16001610 Remove-Item - ErrorAction SilentlyContinue * .wixpdb - Force
16011611
16021612 Write-Verbose " You can find the MSI @ $msiLocationPath "
0 commit comments