diff --git a/assets/Product.wxs b/assets/Product.wxs index 6056a07ec20..699bffb5006 100644 --- a/assets/Product.wxs +++ b/assets/Product.wxs @@ -5,28 +5,36 @@ - - + + + + + + + - + + + + + + + - - - - + @@ -55,7 +63,7 @@ + Value=""[VersionFolder]pwsh.exe" -NoProfile -ExecutionPolicy Bypass -File "[VersionFolder]RegisterManifest.ps1"" /> + Value=""[VersionFolder]pwsh.exe" -NoProfile -ExecutionPolicy Bypass -Command "Enable-PSRemoting"" /> - - + + @@ -158,78 +166,83 @@ - - - - + + - + - + + + - + + - + ADD_PATH=1 - + + + + + - + ADD_EXPLORER_CONTEXT_MENU_OPENPOWERSHELL - - + + - + - + - + - + - + - + - + - + @@ -238,13 +251,12 @@ - + + Target="[VersionFolder]pwsh.exe" + Arguments="-WorkingDirectory ~" /> diff --git a/assets/files.wxs b/assets/files.wxs index ad082d06aa5..3eeac67d2e8 100644 --- a/assets/files.wxs +++ b/assets/files.wxs @@ -1,1930 +1,1929 @@ - - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1932,26 +1931,26 @@ - + - + - + - + - + @@ -1959,1155 +1958,1155 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - + @@ -3646,7 +3645,10 @@ + + + @@ -4096,14 +4098,11 @@ - - - - - - - - + + + + + diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index 1673abf4095..7383167548f 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -191,7 +191,7 @@ function Start-PSPackage { throw $Script:Options.RootInfo.Warning } - # If ReleaseTag is specified, use the given tag to calculate Vesrion + # If ReleaseTag is specified, use the given tag to calculate Version if ($PSCmdlet.ParameterSetName -eq "ReleaseTag") { $Version = $ReleaseTag -Replace '^v' } @@ -337,8 +337,6 @@ function Start-PSPackage { ProductSourcePath = $Source ProductVersion = $Version AssetsPath = "$RepoRoot\assets" - # 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 } @@ -2914,7 +2912,7 @@ function New-MSIPatch # 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\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' + New-MSIPackage -Verbose -ProductSourcePath '.\src\powershell-win-core\bin\Debug\net5.0\win7-x64\publish' -ProductTargetArchitecture x64 -ProductVersion '1.2.3' #> function New-MSIPackage { @@ -2933,11 +2931,6 @@ function New-MSIPackage [ValidateNotNullOrEmpty()] [string] $ProductVersion, - # The ProductCode property is a unique identifier for the particular product release - [Parameter(Mandatory = $true)] - [ValidateNotNullOrEmpty()] - [string] $ProductCode, - # Source Path to the Product Files - required to package the contents into an MSI [Parameter(Mandatory = $true)] [ValidateNotNullOrEmpty()] @@ -2971,15 +2964,15 @@ function New-MSIPackage $wixPaths = Get-WixPath $ProductSemanticVersion = Get-PackageSemanticVersion -Version $ProductVersion - $simpleProductVersion = '7' + $ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion + + $simpleProductVersion = [string]([Version]$ProductVersion).Major $isPreview = Test-IsPreview -Version $ProductSemanticVersion if ($isPreview) { $simpleProductVersion += '-preview' } - $ProductVersion = Get-PackageVersionAsMajorMinorBuildRevision -Version $ProductVersion - $assetsInSourcePath = Join-Path $ProductSourcePath 'assets' $staging = "$PSScriptRoot/staging" @@ -2994,35 +2987,23 @@ function New-MSIPackage $productVersionWithName = $ProductName + '_' + $ProductVersion $productSemanticVersionWithName = $ProductName + '-' + $ProductSemanticVersion - $productDirectoryName = 'PowerShell_6' Write-Verbose "Create MSI for Product $productSemanticVersionWithName" [Environment]::SetEnvironmentVariable("ProductSourcePath", $staging, "Process") # These variables are used by Product.wxs in assets directory - [Environment]::SetEnvironmentVariable("ProductDirectoryName", $productDirectoryName, "Process") [Environment]::SetEnvironmentVariable("ProductName", $ProductName, "Process") - [Environment]::SetEnvironmentVariable("ProductCode", $ProductCode, "Process") [Environment]::SetEnvironmentVariable("ProductVersion", $ProductVersion, "Process") [Environment]::SetEnvironmentVariable("SimpleProductVersion", $simpleProductVersion, "Process") [Environment]::SetEnvironmentVariable("ProductSemanticVersion", $ProductSemanticVersion, "Process") [Environment]::SetEnvironmentVariable("ProductVersionWithName", $productVersionWithName, "Process") if (!$isPreview) { - [Environment]::SetEnvironmentVariable("PwshPath", "[$productDirectoryName]", "Process") - [Environment]::SetEnvironmentVariable("UpgradeCodeX64", '31ab5147-9a97-4452-8443-d9709f0516e1', "Process") - [Environment]::SetEnvironmentVariable("UpgradeCodeX86", '1d00683b-0f84-4db8-a64f-2f98ad42fe06', "Process") [Environment]::SetEnvironmentVariable("IconPath", 'assets\Powershell_black.ico', "Process") - # The ApplicationProgramsMenuShortcut GUID should be changed when bumping the major version because the installation directory changes - [Environment]::SetEnvironmentVariable("ApplicationProgramsMenuShortcut", '6a69de6c-183d-4bf4-a40e-83007d6293bf', "Process") } else { - [Environment]::SetEnvironmentVariable("PwshPath", "[$productDirectoryName]preview", "Process") - [Environment]::SetEnvironmentVariable("UpgradeCodeX64", '39243d76-adaf-42b1-94fb-16ecf83237c8', "Process") - [Environment]::SetEnvironmentVariable("UpgradeCodeX86", '86abcfbd-1ccc-4a88-b8b2-0facfde29094', "Process") [Environment]::SetEnvironmentVariable("IconPath", 'assets\Powershell_av_colors.ico', "Process") - [Environment]::SetEnvironmentVariable("ApplicationProgramsMenuShortcut", 'ab727c4f-2311-474c-9ade-f2c6fd7f7322', "Process") } $fileArchitecture = 'amd64' $ProductProgFilesDir = "ProgramFiles64Folder" @@ -3056,7 +3037,7 @@ function New-MSIPackage } Write-Log "verifying no new files have been added or removed..." - Start-NativeExecution -VerboseOutputOnError { & $wixPaths.wixHeatExePath dir $staging -dr $productDirectoryName -cg $productDirectoryName -gg -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v} + Start-NativeExecution -VerboseOutputOnError { & $wixPaths.wixHeatExePath dir $staging -dr VersionFolder -cg ApplicationFiles -ag -sfrag -srd -scom -sreg -out $wixFragmentPath -var env.ProductSourcePath -v} # We are verifying that the generated $wixFragmentPath and $FilesWxsPath are functionally the same Test-FileWxs -FilesWxsPath $FilesWxsPath -HeatFilesWxsPath $wixFragmentPath @@ -3076,7 +3057,7 @@ function New-MSIPackage } Write-Log "running candle..." - Start-NativeExecution -VerboseOutputOnError { & $wixPaths.wixCandleExePath "$ProductWxsPath" "$FilesWxsPath" -out (Join-Path "$env:Temp" "\\") -ext WixUIExtension -ext WixUtilExtension -arch $ProductTargetArchitecture -v} + Start-NativeExecution -VerboseOutputOnError { & $wixPaths.wixCandleExePath "$ProductWxsPath" "$FilesWxsPath" -out (Join-Path "$env:Temp" "\\") -ext WixUIExtension -ext WixUtilExtension -arch $ProductTargetArchitecture -dIsPreview="$isPreview" -v} Write-Log "running light..." # suppress ICE61, because we allow same version upgrades