Cleanup temporarily created WiX files after compilation to be able to have a clean re-build (#5757)

When changing the WiX installer locally and rebuilding the MSI one can get into the terrible situation whereby a code change does not get compiled into the new MSI.
This PR fixes the root cause of it, which is due to temporary WiX files that are created but not deleted after compilation and WiX then somehow decides to not recompile properly.

I also removed redundant parenthesis of surrounding code.
This commit is contained in:
Chris 2018-01-02 19:33:43 +00:00 committed by Travis Plunk
parent 359a3f078e
commit 238ff90d72

View file

@ -2148,9 +2148,9 @@ function New-MSIPackage
}
[Environment]::SetEnvironmentVariable("ProductProgFilesDir", $ProductProgFilesDir, "Process")
$wixFragmentPath = (Join-path $env:Temp "Fragment.wxs")
$wixObjProductPath = (Join-path $env:Temp "Product.wixobj")
$wixObjFragmentPath = (Join-path $env:Temp "Fragment.wixobj")
$wixFragmentPath = Join-Path $env:Temp "Fragment.wxs"
$wixObjProductPath = Join-Path $env:Temp "Product.wixobj"
$wixObjFragmentPath = Join-Path $env:Temp "Fragment.wixobj"
$packageName = $productSemanticVersionWithName
if ($ProductNameSuffix) {
@ -2168,6 +2168,9 @@ function New-MSIPackage
$WiXLightLog = & $wixLightExePath -out $msiLocationPath $wixObjProductPath $wixObjFragmentPath -ext WixUIExtension -ext WixUtilExtension -dWixUILicenseRtf="$LicenseFilePath" -v
Remove-Item -ErrorAction SilentlyContinue *.wixpdb -Force
Remove-Item -ErrorAction SilentlyContinue $wixFragmentPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjProductPath -Force
Remove-Item -ErrorAction SilentlyContinue $wixObjFragmentPath -Force
if (Test-Path $msiLocationPath)
{