wix installer upgrade dialog not displaying, how to prepare? - windows

I have installed msi on client location. Now i need to provide upgrade. When i prepare new msi with new version it is saying product is already installed. How to upgrade product.
Existing product msi(wix) info:
ProductVersion : 0.0.0.1
PackageCode {B3B7B3A9-AF58-41C0-B3BD-F5ED1B5DE914}
UpgradeCode {63B4B483-1851-4F32-BEFA-E7D73C4CE0DE}
ProductCode {1F3EFF43-C480-4956-B076-76437B6313E6}
My wix looks like this.
<?xml version="1.0" encoding="utf-8"?>
<?define ProductVersion = "0.0.0.2"?>
<?define UpgradeCode = "63b4b483-1851-4f32-befa-e7d73c4ce0de"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="*" Name="Calculator" Language="1033" Version="$(var.ProductVersion)" Manufacturer="ABCD" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<Upgrade Id="$(var.UpgradeCode)">
<!-- Detect older product versions -->
<UpgradeVersion OnlyDetect="no" IncludeMinimum="yes" IncludeMaximum="yes" Minimum="0.0.0.1" Maximum="$(var.ProductVersion)" Property="PREVIOUSVERSIONSINSTALLED" />
<!-- Detect newer product versions -->
<UpgradeVersion OnlyDetect="yes" IncludeMinimum="no" Minimum="$(var.ProductVersion)" Property="NEWERVERSIONDETECTED" />
</Upgrade>
<!-- Exits successfully in the case newer version are already installed -->
<CustomActionRef Id="WixExitEarlyWithSuccess" />
and continues....
Whats wrong in my code. I would like to get upgrade option from this.

It will say the product is already installed if either the ProductCode or the PackageCode of the new MSI is the same as the previous one. It's not clear to me from your post if they have both changed or not.
Also, you won't get an upgrade unless you change something in the first three fields of the ProductVersion. This is the behavior of Windows Installer.
http://msdn.microsoft.com/en-us/library/aa370859(v=vs.85).aspx

Related

WIX Toolset Bundle does not detect package that was just installed

I am creating a super simple bootstrapper project that installs just 1 MSI.
Install works perfectly, but when I do an uninstall from (ARP), the package just installed is not detected, so it is not removed, but the bootstrapper is removed from ARP, making it seem like the product is gone.
I have to run the EXE again, which makes it seem like an install is happening, but when the MSI is executed, it shows the options to change or remove the product (as is expected).
<?xml version="1.0" encoding="UTF-8"?>
<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="Bed Occupancy Monitoring"
Version="$(var.PRODUCTVERSION)"
Manufacturer=""
UpgradeCode="4346DC9B-5B4D-4301-A8A6-EE4ED4C001DB">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
ThemeFile="HyperlinkLargeTheme.xml"
LocalizationFile="HyperlinkTheme.wxl"
LogoFile="Logo.png"
SuppressOptionsUI="yes"
ShowVersion="yes"/>
</BootstrapperApplicationRef>
<Chain>
<MsiPackage Id="BedOccupancy"
SourceFile="$(var.Installer.TargetPath)"
DisplayName="Bed Occupancy $(var.PRODUCTVERSION)"
DisplayInternalUI="yes"
Permanent="no"
Visible="no"/>
</Chain>
</Bundle>
</Wix>

Wix to remove previous version that was installed with Bootstrapper from control panel

I've got "ABC 10.1" program version installed on computer allready and I would like to remove it on each newer ABC.msi installation (for example when ABC 10.2 is going to be installed).
So far I've used a BOOTSTRAPPER to install new versions and it worked like a charm (the previous version was uninstalled and removed from the control panel and newest was appearing in the control panel).
Right now I would like to use ABC.msi for installation and to not use the BOOTSTRAPPER, but when I use ABC.msi installer the previous one is not being removed from the control panel and I have two "ABCs" 10.1 and 10.2 versions in the control panel.
How can I remove ABC previous version that was installed by BOOTSTRAPPER during newest ABC.msi installation (and avoid duplicating ABC in Control Panel)?
Bundle.wxs
<Bundle
Name="$(var.ProductName)"
Version="$(var.ShowVersion)"
Manufacturer="ABC"
UpgradeCode="33312c8d-64f1-4a04-a98e-4aa692de6aaf"
IconSourceFile="$(var.BaseDir)\Setup\UI\ABC.ico"
Condition="((VersionNT = v6.1 AND ServicePackLevel >= 1) OR (VersionNT > v6.1)) AND (WixBundleInstalled = 0)">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="$(var.BaseDir)\Setup\UI\License.rtf"
LogoFile="$(var.BaseDir)\Setup\UI\OticonAppIcon.png"
SuppressOptionsUI="yes"
ShowVersion="yes"/>
</BootstrapperApplicationRef>
<Chain>
<!-- Install .Net 4.6.1 -->
<PackageGroupRef Id='NetFx461Redist'/>
<!-- my packages to install -->
<PackageGroupRef Id="InstallerPackages" />
</Chain>
</Bundle>
<Fragment>
<PackageGroup Id ="InstallerPackages" >
<MsiPackage SourceFile="$(var.OutDir)\ABC.MSI" />
<MsiPackage SourceFile="$(var.OutDir)\DatabaseInstallerABC.msi" />
</PackageGroup>
</Fragment>
productABC.wxs (the file that is creating ABC.msi) is as following:
<?xml version="1.0" encoding="UTF-8"?>
<?include .\defines.wxi ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension" xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Product Id="$(var.ProductCode)"
Codepage="1252" Language="1033"
Manufacturer="ABC" Name="$(var.ProductName)"
UpgradeCode="{3338CE6B-D733-41AF-830B-DCAFE2E0CD58}"
Version="$(var.ProductVersion)">
<Package Id="*"
Compressed="yes"
InstallerVersion="300"
Languages="1033"
Manufacturer="ABC"
Platform="x86" />
<Media Id="1"
Cabinet="media1.cab"
EmbedCab="yes" />
----some directories and components----
<MajorUpgrade
Schedule="afterInstallInitialize"
DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."
AllowSameVersionUpgrades="yes"/>
<InstallExecuteSequence>
<LaunchConditions After="AppSearch" />
<Custom Action="SetTargetDir" Before="CostFinalize"></Custom>
<Custom Action="SaveTargetDir" After="InstallValidate"></Custom>
</InstallExecuteSequence>
<WixVariable Id="WixUILicenseRtf" Value="$(var.BaseDir)\Setup\UI\License.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="$(var.BaseDir)\Setup\UI\bannrbmp.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="$(var.BaseDir)\Setup\UI\ABCbackground.bmp" />
</Product>
</Wix>
Generic answer: The wix bootstrapper is what writes the entry in the Control Panel for your "ABC 10.1" release. In order to remove that, your 10.2 release will need to have a custom action tell the previous bundle to uninstall itself ("previous-cached-bundle.exe /silent /uninstall" or something similar). Now, whether you tell the old bundle to remove itself first, or you allow your MSI to upgrade first is up to your own requirements.

Changing Wix background

Hi and hello to everyone. I've been trying to edit or rather change the background of my installer which I created using Wix. Take note that this is my first time and I have no idea completely when it comes to XML and also in WIX. Kindly advice and help. Thanks.
I have this code which I found on another site.
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject2" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="628c5ddd-baee-48ba-8b16-bad2cb70862b">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SetupProject2" Level="1">
</Feature>
<UIRef Id="WixUI_InstallDir"/>
<Binary Id="Idnumber1" SourceFile="img\banner.png" />
</Product>
Thanks for the help.
If you are trying to use this line
<Binary Id="Idnumber1" SourceFile="img\banner.png" />
to set the background then that's your problem.
If you are setting the background you want to use the WixUIDialogBmp variable.
<WixVariable Id="WixUIDialogBmp" Value="path to your bmp"/>
Additionally as you can see here all the images need to be bitmaps. The file in your example is a png, the WixUIDialogBmp will also need to be 493 x 312.
Also WixToolSet has lots of good walk-throughs and guides, in addition to the documentation.

WiX localization - Desktop/Program menu short cut not replaced in Upgrade

We have recently included localization support for simplified Chiense (zh-cn) in Windows Installer using WIX 3.5. The current version of our product is 1.3.0 and in old version (1.2.0) we do not have any localization support.
We have also changed the product code for 1.3.0 in order to perform major upgrade. And used MSI transform (using Wisubstg.vbs and Wilangid.vbs ) to integrate the localization support into single MSI without using Bootstrapper.
When we test this in Simplified Chinese build in upgrade mode the desktop and prpogram menu short cuts were not replaced but duplicated with Chinese text.
WiX Short cut code is here.
<Shortcut Id="StartServiceShortcut" Icon="StartServiceIcon"
Name="!(loc.STR_StartServiceName)"
Description="!(loc.STR_StartServiceDesc)"
Target="[INSTALLLOCATION]bin\myapp.exe" Arguments="-s"
WorkingDirectory="INSTALLLOCATION"/>
product.Wxl
<String Id="STR_StartServiceName">Start Service</String>
<String Id="STR_StartServiceDesc">Start Services</String>
Installed 1.2 build with Windows 7 English version
Changed the Regional settings to Simplified Chinese and then run the 1.3 Installer.
Seen the Windows Installer Wizard showiing the contents in simplified Chinese.
Installation was successful. But Desktop/Program menus are duplicated with new Chinese text.
Both shorcuts are working with out any issues. But uninstall did not remove both shourt cuts.
Uninstall product does not remove the short cuts. I have also seen that two entries in the Programs/Features list. Also seen there are two different registry entries. The product name and Publisher values are localized all other properties are same in these to Registry keys.
Where am I missing?
Thanks in Advance for any help!
Update:
After changing the upgrade language to '0', I am still getting the same issue. It seems like this new version 1.3 has been installed as totally a new product. Any help!
After changing the upgrade language to '0' I am still getting the same issue. It seems like this new version 1.3 has been installed as totally a new product. Any Help!
<Package InstallerVersion="300" Compressed="yes" InstallPrivileges="elevated" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="0"
Property="NEWPRODUCTFOUND" />
<UpgradeVersion Minimum="$(var.RTMProductVersion)"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="0"
Property="UPGRADEFOUND" />
</Upgrade>
<Product Id="$(var.ProductID)" Name="!(loc.STR_ProductName)" Language="!loc.STR_Language)" Version="$(var.ProductVersion)" Manufacturer="!(loc.STR_Manufacturer)" UpgradeCode="$(var.UpgradeCode)" >
Finally I got it. Thanks to Alex Shevchuk's Blog From MSI to WiX, Part 8 - Major Upgrade
.
The FindRelatedProducts action runs through each record of the Upgrade table in sequence and compares the upgrade code, product version, and language in each row to products installed on the system.
So, After changing my code to something like below, upgrade was successful. Could be useful to others.
Any comments are welcome!
<Product Id="$(var.ProductID)"
Name="!(loc.STR_ProductName)"
Language="0"
Version="$(var.ProductVersion)"
Manufacturer="!(loc.STR_Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="300" Compressed="yes" InstallPrivileges="elevated" Languages="0" Manufacturer="!(loc.STR_Manufacturer)" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Minimum="$(var.ProductVersion)"
IncludeMinimum="no"
OnlyDetect="yes"
Language="0"
Property="NEWPRODUCTFOUND" />
<!-- For UPGRADEFOUND Property, the Language attribute should be set to 1033 as previous version supports only English -->
<UpgradeVersion Minimum="$(var.RTMProductVersion)"
IncludeMinimum="yes"
Maximum="$(var.ProductVersion)"
IncludeMaximum="no"
Language="1033"
Property="UPGRADEFOUND" />
</Upgrade>

Getting an install to upgrade using WiX - old installer created not using WiX

I'm building my first WiX installer after becoming sick of the sight of Wise For Windows Installer!
I've built the installer and that works fine, but now I need to get it to perform an upgrade from the previous version of my app. While I can find plenty of post about setting up WiX do perform upgrades, I can't find anything telling me how to do it when you have a previous installer made using another tool.
Do I do it the same way? Do I need to get upgrade codes, etc, from the old installer? Many thanks in advance!
UPDATE:
Following fletcher's instructions I got the UpgradeCode from the old installer using dark.exe and added it to the Product tag's UpgradeCode. The start of my WiX file now looks thus...
<Product Id="fcdc6617-e960-46db-8faa-1dc627f250c8" Name="MyProduct"
Language="1033" Version="1.2.0.5165" Manufacturer="MyCompany"
UpgradeCode="{E97A233B-AB49-4B66-B92A-68972F6D72B9}">
<Package InstallerVersion="200" Compressed="yes" />
<!-- Upgrade from previous version(s) -->
<Property Id="PREVIOUSVERSIONINSTALLED" Secure="yes" />
<Upgrade Id="{E97A233B-AB49-4B66-B92A-68972F6D72B9}">
<UpgradeVersion Minimum="1.1.0.4605" Maximum="1.2.0.5165"
Property="PREVIOUSVERSIONINSTALLED"
IncludeMinimum="yes" IncludeMaximum="no" />
</Upgrade>
...but now when I run this installer I end up with two instances of MyProduct on the target machine. Where am I going wrong?
In WiX v3.5 there is also the new MajorUpgrade element that makes all this authoring much easier.
It sounds like you want to do a Windows Installer Major Upgrade. Adding the Upgrade table will find the existing product and set your PREVIOUSVERSIONINSTALLED property to the product code.
To remove the old product during your install you need to add the RemoveExistingProducts action to your Execute sequence. There are some choices you have to make on where to sequence this in. The most basic way is to uninstall the old application early in the execute sequence by adding:
<RemoveExistingProducts Before="InstallInitialize" />
You can do the remove later in the execute sequence but you have to be more careful of component rules.
Finally found a solution this morning, thanks everyone who pointed me in the right direction (including DAVID GARDINER's blog). Making sure the Upgrade code is the same as the previous installer, and that both the Product code has changed and the version number has been incremented, here is the full solution:
<Product Id="fcdc6617-e960-46db-8faa-1dc627f250c8" Name="$(var.ProductName)"
Language="1033" Version="$(var.Version)" Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
<!-- without this next line the upgrade doesn't work! (not sure why?) -->
<Property Id="ALLUSERS" Value="1" />
<Upgrade Id="$(var.UpgradeCode)">
<UpgradeVersion Property='PREVIOUSVERSIONSINSTALLED'
OnlyDetect="no" IncludeMinimum='yes'
Minimum='1.1.0.4605' IncludeMaximum='no'
Maximum='$(var.Version)' />
<UpgradeVersion Minimum="$(var.Version)"
IncludeMinimum="no" OnlyDetect="yes"
Language="1033"
Property="NEWERPRODUCTFOUND" />
</Upgrade>
...
<InstallUISequence>
<Custom Action="UIandAdvertised" Sequence="3">
ProductState=1
</Custom>
<LaunchConditions After="AppSearch" />
</InstallUISequence>
<CustomAction Id="PreventDowngrading" Error="Newer version of this product is already installed." />
<CustomAction Id="UIandAdvertised" Error="Something about the UI."/>
<!-- Remove exist products before install -->
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">
NEWERPRODUCTFOUND AND NOT Installed
</Custom>
<LaunchConditions After="AppSearch" />
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
</Product>
I had a similar problem and finally figured it out by running my installer with verbose logging.
The existing installation of my application was getting ignored because it was installed with InstallScope="per-machine" while the default is per-user.
"FindRelatedProducts: current install is per-user. Related install for product '{GUID}' is per-machine. Skipping..."
To solve, I added InstallScope to my package element:
<Package Id='*' ... InstallScope="perMachine"/>
I hope this helps!

Resources