WiX installer - Update scenario Custom UI - user-interface

For my application I have an .msi developed with WiX. For the update scenario I want to do the following:
if the installed version is never than the update version display an error
if the installed version is older than the update version show a button with text Update
if the installed version is the same as the update version show a button with text Repair
I have found how to define custom UI dialogs, but if I create a dialog with all these controls (Error label, Update/Repair buttons) how can I display just the appropriate one according to the situation.

Use the Upgrade property.
Assuming
<Product Version="1.0.0.0" />
and
<Upgrade Id="GUID">
<UpgradeVersion OnlyDetect="no" Property="OLDERFOUND" Maximum="1.0.0.0" IncludeMaximum="no" />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND' Minimum="1.0.0.0" IncludeMinimum='no' />
<UpgradeVersion OnlyDetect='yes' Property='SAMEFOUND' Minimum="1.0.0.0" Maximum='1.0.0.0' />
</Upgrade>
The first upgradeversion finds all versions upto the current one
the second line finds all versions above the current one
the third line finds installed versions the same as the current one
Then use a custom action like so
<CustomAction Id='NewerFound' Error='A later version of [ProductName] is already installed' />
<InstallExecuteSequence>
<Custom Action='NewerFound' After='FindRelatedProducts'>NEWERFOUND</Custom>
<RemoveExistingProducts After="InstallInitialize" />
</InstallExecuteSequence>
etc
The custom actions shown either removes the older version automatically or it warns the user that a newer version is already installed, but if you want to prompt the user then you can show your custom UI instead of running the CAs.
Personally I just use the first two upgradeversion lines. This does the automatic upgrade if an older one is found, shows the user an error if there is a newer one and, if the same one is installed it shows the user an error ( it does that by default it doesnt require the third line), however this doesnt give you the UI like you want, so as I said above try replacing these CAs with your UI.

Related

How to change the button text to 'Upgrade' in WIX(windows installer xml) bootstrapper project when a bundle is running in upgrade process?

I am creating a language package installer by using WIX. I'm almost done except one thing. When newer version of the installer is running after an old version of the same installer has been installed, the Install button still shows "Install", but I expect it shows "Upgrade" when the newer installer is running. After the installation of new installer, the new version has been installed and the old version has been removed. That means the upgrade feature aspect has been accomplished. But I hope the UI especially the button text could be changed accordingly.
I'm using bootstrapper project to bundle the msi language package file which is building from wix setup project, and using the standard UI "WixStandardBootstrapperApplication" linked to a UI definition xml file. I have tried to add a "Upgrade" page in the UI definition xml file, it does not work for me and I do not know how to detect the Upgrade process in bootstrapper project. Here is my code.
<BootstrapperApplicationRef
Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl=""
ThemeFile="HyperlinkTheme.xml"
LocalizationFile="HyperlinkTheme.wxl"
LogoFile="Logo128.jpg"
SuppressOptionsUI="yes" />
</BootstrapperApplicationRef>
<Chain>
<MsiPackage Id="InstallationMSI"
SourceFile="..\..\..\LanguageSetupV3\bin\Debug\en-us\LanguagePackage.msi"
EnableFeatureSelection="yes"
DisplayInternalUI="no"
Compressed="default"
Description="[UpgradeByUninstallInstall][IsTypicalInstall]"
/>
</Chain>
<Page Name="Install">
<Text X="11" Y="121" Width="-11" Height="51" FontId="3" DisablePrefix="yes">#(loc.InstallMessage)</Text>
<!--<Hypertext Name="EulaHyperlink" X="11" Y="121" Width="-11" Height="51" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>
<Checkbox Name="EulaAcceptCheckbox" X="-11" Y="-41" Width="260" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallAcceptCheckbox)</Checkbox> -->
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.InstallOptionsButton)</Button>
<Button Name="InstallButton" X="-91" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallInstallButton)</Button>
<Button Name="WelcomeCancelButton" X="-11" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0">#(loc.InstallCancelButton)</Button>
</Page>
I wanna know how to detect the upgrade process in bootstrapper project and how to change the button text according to a property value. Or how could I find a property or variable to indicate the difference between Install and Upgrade process. Any links, tutorials or suggestions related to this would be appreciate.
In the WixStdBA there is no separate upgrade button defined. The only button seems to be { WIXSTDBA_CONTROL_INSTALL_BUTTON, L"InstallButton" } to start the installation. In the WixStdBA source code I did not find a button named "...UPGRADE..." For upgrading a bundle the new bundle needs to have a higher version number as already discussed above and the bundle upgrade code needs to be constant.
It seems to me that it may be necessary to take the WixStdBA source code and modify it in a way that it detects the existence of any previous installations with the same bundle GUID and modify the code that it displays a different button text depending on the installation status.

Wix Burn: Basic UI handling if No Net Framework is there

I wrote a Boostrapper UI in C# for Net Framework 2.0 using Win-Forms. It started working fine and designed forms are responding as expected.
Here is my Wix Bundle Code:
<?define TargetFile=$(var.MyBA.TargetDir)$(var.MyBA.TargetFileName)?>
<?define BootstrapConfigFile=$(var.MyBA.ProjectDir)BootstrapperCore.config?>
<Bundle Name="Bootstrapper1" Version="1.0.0.0" Manufacturer="Farrukh" UpgradeCode="54c4a4a4-dca8-4ae4-b2f4-5e3f3fd8cb92">
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost">
<Payload SourceFile="$(var.BootstrapConfigFile)"/>
<Payload SourceFile="$(var.TargetFile)"/>
<Payload SourceFile="$(env.WIX)\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
</BootstrapperApplicationRef>
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
<Chain>
<!--<PackageGroupRef Id='Netfx4Full' />-->
<MsiPackage Id="MyInstaller"
Cache="no"
Visible="yes"
DisplayInternalUI="yes"
SourceFile="MyProduct.msi"
/>
</Chain>
</Bundle>
As you can see that it doesn't include NetFX package and as it requires Net-Framework 2.0, I experimented with renaming the Net Framework registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup-Renamed
and 32 bit
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup-Renamed
so that it won't be able to detect it. This resulted in displaying a very basic UI: i.e.
I believe , this was displayed due to following markups in my Bundle, but I'm not sure about that
<WixVariable Id="WixMbaPrereqPackageId" Value="Netfx4Full" />
<WixVariable Id="WixMbaPrereqLicenseUrl" Value="NetfxLicense.rtf" />
However, when I clicked "Accept and Install" nothing happened and buttons just got disappeared. That may be because I added no NetFx Package, neither any reference to WixNetFxExtension. (And I will definitely gonna add these and will see results later).
Question: I want to edit this basic UI so if my user try to install it on Windows XP (with no Net Framework), he/she would get the UI as I will design, not this basic one. So how can I edit this basic UI?
I feel, I'm missing some basic thing here, but need some guidance.. would really appreciate any help/guidance.
Regards
I was able to solve this after finding a thread on Wix User's mailing list. Here it is:
customizing burn prerequisite boostrapper image in theme
So this screen is known as Burn Prerequisite and it has a special WixVariable ID. Here is code from my Bootstrapper, depicting the use of my own custom theme for Burn's pre-req screen:
<WixVariable Id="PreqbaThemeXml" Value="..\resources\MbaPrereqTheme.xml" />
<WixVariable Id="PreqbaThemeWxl" Value="..\resources\MbaPrereqTheme.wxl" />
And any resources like Logo.png, Banner.bmp and NetfxLicense.rtf etc which you have referenced in MbaPrereqTheme.xml, would have to be part of Bootstrapper as a PayLoad:
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
<Payload SourceFile="$(var.BootstrapConfigFile)"/>
<Payload SourceFile="$(var.MyBootstrapDll)"/>
<Payload SourceFile="$(env.WIX)\SDK\Microsoft.Deployment.WindowsInstaller.dll"/>
<!-- Following are required as payload and to be used by Pre-Req screen.-->
<Payload SourceFile="..\resources\logo.png"/>
<Payload SourceFile="..\resources\Banner.bmp"/>
<Payload SourceFile="..\resources\NetfxLicense.rtf"/>
</BootstrapperApplicationRef>
And this started working just like as I wished :).
Regards

WiX Patch dialog - background image not shown

I have created an working WiX Patch but during it's installation it does not show the product background image.
The original product setup dialog shows the images and they are defined in it's project like:
<Product ...>
<WixVariable Id="WixUIBannerBmp" Value="gn_setup_dialog_banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="gn_setup_dialog.bmp" />
The patch is created and works fine. The problem is that it does not show these images. It shows some default background for the dialog.
Here is my patch if this helps:
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
<Patch AllowRemoval='yes'
Manufacturer='xxx'
MoreInfoURL='...'
DisplayName='...'
Description='Small Update Patch'
Classification='Update'
Codepage="...">
<Media Id='5000' Cabinet='RTM.cab'>
<PatchBaseline Id='RTM' />
</Media>
<PatchFamily Id="HotFixPatchFamily" Version="1.0.1.0" Supersede="no" />
</Patch>
</Wix>
Thanks for helping.
For some reason the patch was delivering these two files as "new" ones...even tough they were not changed.
Anyway, I solved the problem by replacing the stock Wix dialog images, like it is suggested here (at bottom "Replacing the stock bitmaps"):
http://wix.sourceforge.net/manual-wix2/WixUI_dialog_library.htm

WiX: Calling Custom Action on Merge Module only if Feature is selected

I have a WiX installer which has 3 Projects. 2 Creates Merge Moduels, 1 Creates the installer. The code in the mergemodules should only be executed if the corresponding feature is selected. Is there any chance to get this to work with custom actions?
From my experience the custom actions are always called - wether or not a certain feature is selected...
Code in the Podoct:
<Feature Id="Complete" Title="SDK Setup" Description="Installs the sdk" Display="expand" Level="1" ConfigurableDirectory="INSTALLLOCATION">
<Feature Id="SDK" Title ="SDK" Description="" Level ="1">
....
In the Merge Module I call some custom actions, e.g.:
<CustomAction Id='CustomAction' BinaryKey='CaDll' DllEntry='CaEntry' Execute='deferred' />
<CustomAction Id="CustomAction.SetProperty" Return="check" Property="CustomAction" Value='test' Execute='immediate' />
<InstallExecuteSequence>
<Custom Action='CustomAction.SetProperty' After='CostFinalize'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) </Custom>
<Custom Action='CustomAction' After='InstallFiles'>(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE) </Custom>
Custom actions in general are not tied to components or features. From one perspective this is because they should be written in a data-driven fashion: inspect the install and action states of all components in your code to build up a list of actions to take.
But when actions don't make sense that way (even with the help of a custom database table), you can always tie them to the action state of the feature or component by their condition. See Conditional Statement Syntax for "Access Prefixes" or "Feature and Component State Values", and in particular the examples near the bottom: &MyFeature=3 is true when MyFeature is being installed.

How do I create a custom dialog in WiX for user input?

I'm using WiX to create an installer for a windows service. It's desirable that the name of service that gets installed and displayed in Services is configurable at install time.
For example, this is what I'm thinking (wix xml snip):
<ServiceInstall
Id="MyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Description="My Service"
Account="localsystem"/>
<ServiceControl
Id="StartMyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Start="install"
Wait="no" />
<ServiceControl
Id="StopMyServiceInstaller"
Name="NAME_PASSED_FROM_DIALOG"
Remove="uninstall"
Stop="both"
Wait="yes" />
NAME_PASSED_FROM_DIALOG is something I would like to hook up to a custom dialog that gets created and gets displayed to the person installing the service so they can set/modify the service name. I think this is very similar to the WIXUI_INSTALLDIR property that gets set and passed to the WixUI_InstallDir Dialog Set.
My question is:
How do I create a custom UI dialog that can accept user input which gets passed into runtime of the installer?
Have fun with UI!
Edit: The original link to answer doesn't exist anymore. FireGiant (the maintainers of Wix) some examples for part of this process, but it's doesn't completely answer this question. There is one further tutorial (UPDATE Aug.2018: Link resurrected from Wayback Machine) that does go most of the way to answer this question.
A high level overview of what will be happening is:
Create a property
Have the UI control set this property
The name attribute on the service will reference the property, ie [ServiceNameProperty].
However this is complex, and the way that is suggested to create a new UI dialog, is to take an existing dialog, make a clone of it, and then edit with new text, controls and use it to populate the property.
Try to use
WixEdit
that is nice tool for creating UI

Resources