Wix installer creates new entry instead of upgrading existing msi - wix

My Bundle exe has following code
<PackageGroup Id="MyWeb">
<MsiPackage SourceFile="Release\en-us\MyWeb.msi" Cache="no" Id="MyWebMSI" Compressed="yes" ForcePerMachine="yes" Vital="yes" DisplayName="My WEB">
<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]"/>
<MsiProperty Name="MyWebPORT" Value="[MyWebPORTNO]"/>
<MsiProperty Name="INSTALLCERTIFICATES" Value="[DOINSTALLCERTIFICATES]"/>
</MsiPackage>
</PackageGroup>
MyWeb.msi is again a wix installer with below code:
<Product Id="*" UpgradeCode="442a9a72-ada7-4c68-b77f-feb99e67a23a"
Version="!(bind.FileVersion.filename)"
Name="!(loc.ProductName)"
Language="!(loc.LANG)"
Manufacturer="!(loc.ManufacturerName)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated"
Languages="!(loc.LANG)"
Manufacturer="!(loc.CompanyName)" Comments="!(loc.Comments)"
Description="!(loc.Description)" Keywords="!(loc.Keywords)"/>
<MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
</Product>
<Fragment>
...
</Fragment>
However, While upgrading my bundle exe, instead of upgrading my msi installer creates new entry
I want my msi to get updated and not a new entry to be created in Add/Remove Programs

Related

WiX bundle creates multiple entries in the ARP for the same version

I've created a WiX bundle that simply installs a VC redist and than an MSI.
Looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="Thrust" Version="1.1.0.0" Manufacturer="Maker" UpgradeCode="e356a490-31a8-4c0b-9aeb-82cbf3350082">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<!-- Install Required VCRedist -->
<PackageGroupRef Id="VCRedist"/>
<!-- Install Thrust Msi -->
<MsiPackage Id="ThrustInstaller"
Cache="yes" Compressed="yes" Visible="yes"
DisplayInternalUI="no"
SourceFile="..\ThrustInstaller\bin\Release\ThrustInstaller.msi">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<util:RegistrySearch
Variable="IsVCInstalled"
Root="HKLM"
Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
Value="Installed"
Win64="yes"
/>
<util:RegistrySearch
Variable="VCVersionMajor"
Root="HKLM"
Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
Value="Major"
Win64="yes"
/>
<util:RegistrySearch
Variable="VCVersionMinor"
Root="HKLM"
Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
Value="Minor"
Win64="yes"
/>
<util:RegistrySearch
Variable="VCVersionBld"
Root="HKLM"
Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\X64"
Value="Bld"
Win64="yes"
/>
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="" />
<WixVariable Id="WixMbaPrereqPackageId" Value="VCRedist" />
<PackageGroup Id="VCRedist">
<ExePackage Id="VCRedist"
SourceFile="..\..\external\VC_redist.x64.exe"
InstallCommand="/q /norestart"
Cache="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
Compressed="yes"
DetectCondition="IsVCInstalled AND VCVersionMajor >= 14 AND VCVersionMinor >= 27 AND VCVersionBld >= 29016"
InstallCondition="1"/>
</PackageGroup>
</Fragment>
</Wix>
The VC redist installation works as expected.
However, when installing a bundle with the same version but different internal version of the MSI, I can see that the MSI is being installed, but I'm getting duplicated entries for the bundle in the ARP(only 1 entry for the MSI as expected).
In the MSI I'm allowing same version upgrades:
<MajorUpgrade AllowDowngrades="no" AllowSameVersionUpgrades="yes" Schedule="afterInstallInitialize" DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
I'm guessing that the reason for the two entries in the ARP is that the bundle doesn't allow same version upgrades?
I'm not satisfied with the answer in how-to-do-major-upgrades-when-using-burn-wix-3-6, It suggests to upgrade the bundle version. Can't I achieve a behavior s.t if the MSI version is different from the one installed, but the bundle version is the same, it will not cause duplicated ARP entries?
Thanks.

WiX Bundle: Patches for 1.0.0 are not removed from Programs & Features when bundle 2.0.0 is installed

There are 3 bundles, code is listed below. 1.0.0, 1.0.0.1, and 2.0.0.
If 1.0.0, 1.0.0.1, and 2.0.0 are installed, View Installed Updates will still have 1.0.0.1 listed as installed. It will remain there until the last Version is uninstalled.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Burn Installer" Version="1.0.0" Manufacturer="LANSA" UpgradeCode="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" Copyright="..." AboutUrl="...">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<MsiPackage Id="MainPackage" SourceFile="TESTLIST_v1.0.0_en-us.msi" Vital="yes" DisplayInternalUI="yes" />
</Chain>
</Bundle>
</Wix>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Patch 1.0.0.1" ParentName="Burn Installer" Version="1.0.0.1" Manufacturer="LANSA" UpgradeCode="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" Copyright="..." AboutUrl="...">
<RelatedBundle Id="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" Action="Patch"/>
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<MspPackage Id="Patch" SourceFile="TESTLIST_v1.0.0.1_en-us.msp" Vital="yes" DisplayInternalUI="no" PerMachine="yes" Permanent="no"/>
</Chain>
</Bundle>
</Wix>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Bundle Name="Burn Installer" Version="2.0.0" Manufacturer="LANSA" UpgradeCode="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" Copyright="..." AboutUrl="...">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Chain>
<MsiPackage Id="MainPackage" SourceFile="TESTLIST_v2.0.0_en-us.msi" Vital="yes" DisplayInternalUI="yes" />
</Chain>
</Bundle>
</Wix>
When an Upgrade is applied, all prior Versions and Patches should be delisted from Programs and Features and/or View Installed Updates. Exactly the same as does occur when the MSI/MSP are directly installed rather than through the Bundler.
The answer for WiX 3.9 and later is as follows...
In Major Upgrade bundles the UpgradeCode must match. "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA" in the example below.
In Patch Bundles the Upgrade Code must be unique, unrelated to any other GUID used in any bundle. "CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC" in the example.
In the Major Upgrade bundles the RelatedBundle must be unique. This GUID is used in all the patches for that Major Upgrade. "BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB" in the example.
These settings also ensure that the Major Upgrades are listed in Programs and Features and the patches are listed in View Installed Updates.
<Bundle Version="1.0.0" UpgradeCode="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA">
<RelatedBundle Id="BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB" Action="Detect" />
</Bundle>
<Bundle Version="1.0.0.1" UpgradeCode="CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC">
<RelatedBundle Id="BBBBBBBB-BBBB-BBBB-BBBB-BBBBBBBBBBBB" Action="Patch" />
</Bundle>
<Bundle Version="2.0.0" UpgradeCode="AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA">
<RelatedBundle Id="DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD" Action="Detect" />
</Bundle>

Update MSI package via Wix bootstrapper

I have wix bootstapper which includes 4 components: tree exe packages and one msi package. I want to do major update of msi package using bootstrapper below (only main code):
<Bundle Name="$(var.Name)" Version="$(var.Version)" Manufacturer="$(var.Manufacture)" UpgradeCode="$(var.UpgradCode)" Copyright="$(var.Copyright)">
....
<Chain>
<!-- TODO: Define the list of chained packages. -->
<PackageGroupRef Id="NetFx4Full"/>
<PackageGroupRef Id="PostgreSQL"/>
<PackageGroupRef Id="AdobeReader"/>
<PackageGroupRef Id="Application"/>
</Chain>
....
<PackageGroup Id="Application">
<MsiPackage Id="MyApplication"
SourceFile=".\MSI_File\application.msi"
DisplayInternalUI="yes"
Permanent="no"
Vital="yes"
Visible="no"/>
others packages...
</PackageGroup>
and msi code:
<Product Id="*"
Name="$(var.Name)"
Language="$(var.InstallerLanguage)"
Version="$(var.Version)"
UpgradeCode="$(var.UpgradeCode)"
Manufacturer="$(var.Manufacture)">
<Package Description="$(var.PackageDescritpion)"
InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine"
InstallPrivileges="elevated"
Platform="x64"/>
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<Directory Id="TARGETDIR" Name="SourceDir">
</Directory>
<Feature Id="Complete"
Level="1"
ConfigurableDirectory="INSTALLDIR">
<ComponentRef Id="Licence"/>
<ComponentRef Id="StartMenuFoldersComponent"/>
<ComponentRef Id="DatabaseConfigFolder"/>
<ComponentGroupRef Id="BinaryFileGroup"/>
<ComponentGroupRef Id="DatabaseConfigFileGroup"/>
<ComponentRef Id="ApplicationConfigFolder"/>
<ComponentRef Id="RemoveFolderOnUninstall"/>
</Feature>
<!-- Custom actions-->
.....
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallValidate"/>
<!--Other custom actions-->
......
</InstallExecuteSequence>
To build my update msi and bootstrapp I set greater (the same for msi and bootstrapp) product version, for example old version has 1.0.0.0 and newer has 1.0.1.0. Upgrade code as a WIX documentation says remains unchanged. After run my update installer the new version of msi is not installig, in install directory still are old files. Does anyone know what I do wrong?
#Edit
Also I tried by adding MajorUpgrade element but after that bootstrapper doesn't start MSI:
<Media Id="1" Cabinet="contents.cab" EmbedCab="yes" CompressionLevel="high"/>
<MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<Directory Id="TARGETDIR" Name="SourceDir"/>
#Edit
Bootstrapper logs: http://wklej.to/Msczq
You need to add upgrade information to the .msi package. See http://wixtoolset.org/documentation/manual/v3/howtos/updates/major_upgrade.html for use of the MajorUpgrade element.

Prevent Burn from uninstalling .NET package

I'm using a WiX bootstrapper to install .NET and my application. The .NET installation is specified in a chain using the statement
<PackageGroupRef Id="NetFx40Redist">
When I uninstall using the bootstrapper, the .NET package is also uninstalled. How can I modify the above statement to tell the bootstrapper not to remove the .NET package?
EDIT: Following is the code I ended up writing to do this. Comments are welcome if there is anything I should do differently.
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="appName" Version="$(var.Version)" Manufacturer="mfr" UpgradeCode="your-GUID"
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" />
<Variable Name="InstallFolder" Type="string" Value="[ProgramFilesFolder]mfrName\appName" />
<Chain>
<PackageGroupRef Id="Net4Redist"/>
<MsiPackage
Id="MsiInstaller"
Compressed="yes"
SourceFile="$(var.SolutionDir)\appName_Installer\bin\$(var.Configuration)\appName_Installer.msi"
Permanent="no"
Vital="yes">
<MsiProperty Name="INSTALLLOCATION" Value="[InstallFolder]" />
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id="Net4Redist">
<ExePackage Id="Netfx40Xxx" Cache="no" Compressed="yes" PerMachine="yes"
Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="$(var.SolutionDir)\Bootstrapper\redist\dotNetFx40_Full_x86_x64.exe"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0)"/>
</PackageGroup>
</Fragment>
</Wix>
Did you try using the "Permanent" attribute in the EXEPackage element?
EXEPackage
Glad you solved your issue but, as you mentioned, you do not have any detect condition setup so that is probably why you are seeing .NET processing every time you run your installer. If you add the following registry search and detect condition to your example you should not see that anymore:
<Fragment>
<util:RegistrySearchRef Id="NETFRAMEWORK40"/>
<PackageGroup Id="Net4Redist">
<ExePackage Id="Netfx40Xxx" Cache="no" Compressed="yes" PerMachine="yes"
Permanent="yes" Vital="yes" InstallCommand="/q"
SourceFile="$(var.SolutionDir)\Bootstrapper\redist\dotNetFx40_Full_x86_x64.exe"
DetectCondition="NETFRAMEWORK40"
InstallCondition="(VersionNT >= v6.0 OR VersionNT64 >= v6.0)"/>
</PackageGroup>
</Fragment>

WiX Bundle upgrade: a new version of MSI is installed before the old version is removed

I have a WiX bundle that installs an MSI and also checks if .NET is installed. Everything works as expected when installing the bundle (and the installer).
My problem is when the bundle is upgraded. In an upgrade, the bundle first installs v_Next of the MSI and when then unininstalls v_Previous of the MSI.
How can I change this order? I want that in an upgrade the v_Previous of the MSI is uninstalled before the v_Next is installed.
Below is my bundle:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="MyProductName"
Version="1.0.0.0"
Manufacturer="MyCompanyName"
UpgradeCode="4abf3f67-1234-35b1-b2c1-dd7649b60e1d">
<BootstrapperApplicationRef
Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
SuppressOptionsUI="yes"
LicenseFile="License.rtf"
ThemeFile="Theme.xml"
LogoFile="MyProductName.png"
/>
<Payload
Name="BootstrapperCore.config"
SourceFile="BootstrapperCore.config"/>
<Payload
SourceFile="NetfxLicense.rtf"/>
</BootstrapperApplicationRef>
<Chain>
<PackageGroupRef
Id="Netfx4Full"/>
<MsiPackage
Compressed="yes"
SourceFile="$(var.SolutionDir)\Setup\MyProductName.msi"
Vital="yes">
</MsiPackage>
</Chain>
</Bundle>
<Fragment>
<WixVariable
Id="WixMbaPrereqPackageId"
Value="Netfx4Full" />
<WixVariable
Id="WixMbaPrereqLicenseUrl"
Value="NetfxLicense.rtf" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4FullVersion" />
<util:RegistrySearch
Root="HKLM"
Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
Value="Version"
Variable="Netfx4x64FullVersion"
Win64="yes" />
<PackageGroup
Id="Netfx4Full">
<ExePackage
Id="Netfx4Full"
Cache="no"
Compressed="no"
PerMachine="yes"
Permanent="yes"
Vital="yes"
SourceFile="$(var.SolutionDir)\packages\dotNetFx40_Full_x86_x64.exe"
DownloadUrl="http://go.microsoft.com/fwlink/?LinkId=164193"
DetectCondition="Netfx4FullVersion AND (NOT VersionNT64 OR Netfx4x64FullVersion)"/>
</PackageGroup>
</Fragment>
</Wix>
Thank you Rob for the answer. I'm trying to do that, but it's not working (I'm surelly missing something)... This is what I have in the MSI:
<Product Id="*"
Name="MyProductName"
Language="1033"
Version="1.0.0.0"
Manufacturer="MyCompanyName"
UpgradeCode="aa027fd0-5111-1236-9af6-55581a588123">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of MyProductName is already installed."
AllowDowngrades="no"/>
<MediaTemplate />
<Feature Id="ProductFeature"
Title="MyProductName"
Level="1">
<ComponentRef Id="ApplicationShortcut" />
<ComponentGroupRef Id="AllFiles" />
</Feature>
</Product>
If I run the v_previous MSI and then v_Next MSI (separatelly, not within the bundle) I get both installed, so no upgrade is being performed. What Am I doing wrong?
Nevermind, MajorUpgrade is working. My version numbering was wrong in the vNext MSI. I need now to also add minor upgrade support.
Upgraded bundles are always uninstalled last today**. To remove v_Previous.msi before v_Next.msi, have the v_Next.msi major upgrade (see the MajorUpgrade element) the v_Previous.msi.
** I think there is a feature request to allow other placements but no one has implemented that yet.