From 8ba6f319f3bf22db25484e892624dd283758fc87 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Tue, 13 Mar 2018 14:02:12 -0700 Subject: [PATCH] MSI: update architecture specific filenames (#6379) --- assets/files.wxs | 7 ++++--- tools/packaging/packaging.psm1 | 10 ++++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/assets/files.wxs b/assets/files.wxs index aae18df13f..a61bee0800 100644 --- a/assets/files.wxs +++ b/assets/files.wxs @@ -1,6 +1,7 @@  + @@ -127,7 +128,7 @@ - + @@ -418,7 +419,7 @@ - + @@ -649,7 +650,7 @@ - + diff --git a/tools/packaging/packaging.psm1 b/tools/packaging/packaging.psm1 index f1d5ee8612..9f37304733 100644 --- a/tools/packaging/packaging.psm1 +++ b/tools/packaging/packaging.psm1 @@ -2163,13 +2163,15 @@ function New-MSIPackage [Environment]::SetEnvironmentVariable("UpgradeCodeX64", '39243d76-adaf-42b1-94fb-16ecf83237c8', "Process") [Environment]::SetEnvironmentVariable("UpgradeCodeX86", '86abcfbd-1ccc-4a88-b8b2-0facfde29094', "Process") } - + $fileArchitecture = 'amd64' $ProductProgFilesDir = "ProgramFiles64Folder" if ($ProductTargetArchitecture -eq "x86") { + $fileArchitecture = 'x86' $ProductProgFilesDir = "ProgramFilesFolder" } [Environment]::SetEnvironmentVariable("ProductProgFilesDir", $ProductProgFilesDir, "Process") + [Environment]::SetEnvironmentVariable("FileArchitecture", $fileArchitecture, "Process") $wixFragmentPath = Join-Path $env:Temp "Fragment.wxs" $wixObjProductPath = Join-Path $env:Temp "Product.wixobj" @@ -2245,7 +2247,11 @@ function Test-FileWxs [string] $HeatFilesWxsPath ) - [xml] $filesAssetXml = Get-Content -Raw -Path $FilesWxsPath + # Update the fileArchitecture in our file to the actual value. Since, the heat file will have the actual value. + # Wix will update this automaticaly, but the output is not the same xml + $filesAssetString = (Get-Content -Raw -Path $FilesWxsPath).Replace('$(var.FileArchitecture)',$env:FileArchitecture) + + [xml] $filesAssetXml = $filesAssetString [xml] $heatFilesXml = Get-Content -Raw -Path $HeatFilesWxsPath $assetFiles = $filesAssetXml.GetElementsByTagName('File') $heatFiles = $heatFilesXml.GetElementsByTagName('File')