License Agreement Interface in WIX Setup Project - wix

As i am trying to build a customized Wix Setup project i need to include a license agreement interface. using WixUiExtension I can do it easily with this code
<WixVariable Id="WixUILicenseRtf" Value="sample.rtf" />
But how can i get this .rtf file in my customized .wxs form without using WixUiExtension ?

Define it like this inside your UI tags:
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
<Text SourceFile="sample.rtf" />
</Control>

Related

WiX Installer dialog closing after custom action

I have a WiX installer that has a dialog with a button on it.
When I click the button, I want it to open a web page using the default browser.
I've managed to successfully do this, but the problem is that after I click on the button and the web page is launched, the installer closes.
What do I need to do to keep it open?
Here is my code (just the relevant parts):
<!-- the button -->
<Control Id="webpage" Type="PushButton" X="15" Y="245" Width="110" Height="17" Text="!(loc.webpage)" TabSkip="no" Default="yes" >
<!-- the button action -->
<Publish Dialog="MyDlg" Control="webpage" Event="DoAction" Value="OpenWebPage">1</Publish>
<!-- the action (is defined in a dll) -->
<Binary Id='FooBinary' SourceFile='Dll1.dll'/>
<CustomAction Id='OpenWebPage' BinaryKey='FooBinary' DllEntry='open_website' Execute='immediate' Return='check'/>

WIX: do I have to manually recreate all elements of a dialog, including banners and buttons?

New to WIX here :-)
I added a new dialog to my WIX setup project, and it works well, except that this dialog ONLY shows the controls I added to it - it doesn't have the next/back/cancel buttons or the banner that the other dialogs have.
Did I do something wrong or do I have to manually recreate all controls, inclulding banners? If I have to manually recreate them, where do I find the WXS files that contains the originals?
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<RadioButtonGroup Property="MyApp_Database_Type">
<RadioButton Height="17" Text="Dedicated" Value="Dedicated" Width="348" X="0"
Y="0" />
<RadioButton Height="17" Text="Shared" Value="Shared" Width="348" X="0"
Y="18" />
<RadioButton Height="17" Text="Single User" Value="Single User" Width="348" X="0"
Y="36" />
</RadioButtonGroup>
<Dialog Id="MyApp_UI_DatabaseProperties" X="50" Y="50" Width="373" Height="287"
Title="[ProductName]: Database Properties">
<Control Id="CTL_MyApp_UI_DatabaseProperties" Type="RadioButtonGroup" X="18" Y="108" Width="348" Height="48"
Property="MyApp_Database_Type" Text="System Type" TabSkip="no" />
<Control Id="Back" Type="PushButton" X="156" Y="243"
Width="56" Height="17" Hidden="no" Disabled="no" Text="Back" />
<Control Id="Next" Type="PushButton"
X="212" Y="243" Width="80" Height="17" Default="yes"
Text="Next" Hidden="no" Disabled="no">
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
Yes you have to fully define the dialog you want to use. Each dialog is a self contained and describing thing. It doesn't know about the layout or format of any other dialogs in the installation.
You can see examples of the dialogs you are probably using with the WixUIExtension.dll right here. This is the source code of the UIExtension's wixlib.
You should be able to simply copy over the shared components from the other dialogs into the one you are describing to get it working as you expect.

How to show dialog or message box during uninstall in WiX?

I'm trying to show a dialog or message box(with yes or no buttons) during uninstall.
I need to set a property with user's choice from my dialog (Yes(true) or No(false)).
This property is important because all the files are going to be deleted if user's answer is "Yes".
I tried to show a custom dialog on uninstall and that didn't work. Custom dialog didn't give me an error. It doesn't even appear in the verbose log.
Here is the custom dialog:
<Dialog Id="ClearAllDataDlg" Width="260" Height="85" Title="[Setup] - [ProductName]" NoMinimize="yes">
<Control Id="No" Type="PushButton" X="132" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="[ButtonText_No]">
<Publish Property="CLEARALLDATA" Value="0" />
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
<Control Id="Yes" Type="PushButton" X="72" Y="57" Width="56" Height="17" Text="[ButtonText_Yes]">
<Publish Property="CLEARALLDATA" Value="1" />
<Publish Event="EndDialog" Value="Exit">1</Publish>
</Control>
<Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30">
<Text>Do yo want to clear all data including your settings?</Text>
</Control>
<Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="[InfoIcon]" />
</Dialog>
and the InstallUISequence:
<Show Dialog="ClearAllDataDlg" Before="CostFinalize">REMOVE ~= "ALL"</Show>
I tried After="MigrateFeatureStates" in the Sequence but that didn't work either.
In another question somebody asked Stopping display of custom dialog boxes in WiX uninstall that is funny because all the other questions are trying to do it's opposite.
I don't want to do this inside of a custom action because i want to block the uninstall progress and wait for the user's answer.
Is there any way to accomplish this?
Any help would be appreciated. Thank you!
I do exactly this in a SDK install we produce. The idea being that if the user has done any actual development inside the SDK install location everything is getting deleted and we want to make sure they save anything they really need.
I didn't create a new dialog for this warning box because a message box is a very well-defined and used concept in all windows products.
In product I added a custom action scheduled before anything actually happens.
<CustomAction Id='CA_UninstallWarning' BinaryKey='SDKCustomActionsDLL' DllEntry='UninstallWarning' Execute='immediate' Return='check' />
<InstallExecuteSequence>
<Custom Action='CA_UninstallWarning' Before='FindRelatedProducts'>NOT UPGRADINGPRODUCTCODE AND REMOVE~="ALL"</Custom>
...
</InstallExecuteSequence>
And in my custom action I have
[CustomAction]
public static ActionResult UninstallWarning(Session session)
{
session.Log("Begin UninstallWarning.");
Record record = new Record();
record.FormatString = session["WarningText"];
MessageResult msgRes = session.Message(InstallMessage.Warning | (InstallMessage)System.Windows.Forms.MessageBoxButtons.OKCancel, record);
session.Log("End UninstallWarning.");
if (msgRes == MessageResult.OK)
{
return ActionResult.Success;
}
return ActionResult.Failure;
}
In your case you can use messageboxbuttons.YesNo instead of OKCancel
With return="check" in your custom action, the installation will stop if you return ActionResult.Failure from the custom action.
I do have this uninstall launching from a wix bootstrapper but the behaviour should be the same.

How to display a dialog box with warning message in Wix installer?

I need to display a warning message while running my installer if a firefox maintenance service is installed.
To achieve this, I added a registry search property, and then added the code for dialog box in wix:
<Property Id="MAINTENANCESERVICEINSTALLED">
<RegistrySearch Id="MSID" Root="HKLM" Key="SOFTWARE\Mozilla\MaintenanceService" Name="Installed" Type="raw"/>
</Property>
<UI>
<Dialog Id="MaintenanceServiceWarningDialog" Width="284" Height="73" Title="Warning" NoMinimize="yes">
<Control Id="Text" Type="Text" X="38" Y="8" Width="240" Height="40" TabSkip="no">
<Text>Firefox Maintenance is installed on your system. Disable it to prevent compatibility issues. Click OK to proceed.</Text>
</Control>
<Control Id="OK" Type="PushButton" X="114" Y="52" Width="56" Height="17" Default="yes" Cancel="yes" Text="OK">
<Publish Event="EndDialog" Value="Return">1</Publish>
</Control>
</Dialog>
<InstallUISequence>
<Show Dialog="MaintenanceServiceWarningDialog" Sequence="1"> <![CDATA[NOT Installed AND MAINTENANCESERVICEINSTALLED]]></Show>
</InstallUISequence>
</UI>
I am using to show the dialog box. The above code is under "Product" tag.
I am getting build issues with this like below. And when I move the UI code to Fragment, the installer does not display anything. Not sure what's wrong.
Your InstallUISequence element is inside the UI element.

WiX installer - Set ApplicationFolder from ComboBox

I'm writing a WiX installer for a group of medical device SW products that must install in specific directories off the root of C:. IE no "ProgramFolders" for these.
They run in dedicated environments and have been verified and validated using these directories.
I have a custom welcome dialog that has a combobox:
<Control Id="TypeCombo" Type="ComboBox" X="178" Y="162" Width="120" Height="20" Property="InstallChoiceResult" ComboList="yes" Sorted="no">
<ComboBox Property="InstallChoiceResult">
<ListItem Text="Base dev 1" Value="1"/>
<ListItem Text="Base dev 2" Value="2"/>
<ListItem Text="Base dev 3" Value="3"/>
<ListItem Text="Base Simulator" Value="4"/>
</ComboBox>
</Control>
The choice by the FSE sets the property "InstallChoiceResult". After they hit next I need to set my application folder based on their choice. IE if they chose "Base dev 1" then I need to set APPLICATIONFOLDER to C:\BASEDEV1. If they choose Base dev 2 then we go to C:\BASEDEV2
Being new to WiX I'm strugging with the sequence. It seems from examining my MSI with Orca that the InstallUISequence comes AFTER the costing occurs. When I try to set the APPLICATION folder using a group of custom actions it complains that since it is a directory it must be set before CostFinalize.
I'm sure I'm missing something simple but if my UI seems to be running AFTER that how can I set the directory I need? My custom actions currently look like:
<CustomAction Id="SetDev1" Property="APPLICATIONFOLDER" Value="C:\BaseDev1" Execute="immediate" />
<CustomAction Id="SetDev2" Property="APPLICATIONFOLDER" Value="C:\BaseDev2" Execute="immediate" />
<CustomAction Id="SetDev3" Property="APPLICATIONFOLDER" Value="C:\BaseDev3" Execute="immediate" />
<CustomAction Id="SetDevS" Property="APPLICATIONFOLDER" Value="C:\BaseDevS" Execute="immediate" />
<InstallUISequence>
<Custom Action="SetDev1" Before="InstallDlg2">InstallChoiceResult=1</Custom>
<Custom Action="SetDev2" Before="InstallDlg2">InstallChoiceResult=2</Custom>
<Custom Action="SetDev3" Before="InstallDlg2">InstallChoiceResult=3</Custom>
<Custom Action="SetDevS" Before="InstallDlg2">InstallChoiceResult=4</Custom>
</InstallUISequence>
The general jest of what I need to do is basically this:
Display dialog (FSE chooses 1, 2, 3 or simulator)
After next is pressed, Set ApplicationFolder based on property from ComboBox
Install into the set ApplicationFolder
Any help would be very much appreciated.
You can set the directory values to APPLICATIONFOLDER using SetDirectory element. No need to use Custom action and bind the directory values directly to the List item. Make the Combo box property is public (All letter in uppercase).
<Control Id="TypeCombo" Type="ComboBox" X="142" Y="158" Width="120" Height="16" Property="INSTALLCHOICERESULT" ComboList="yes" Sorted="no">
<ComboBox Property="INSTALLCHOICERESULT">
<ListItem Text="Base dev 1" Value="C:\BaseDev1" />
<ListItem Text="Base dev 2" Value="C:\BaseDev2" />
<ListItem Text="Base dev 3" Value="C:\BaseDev3" />
<ListItem Text="Base Simulator" Value="C:\BaseDevS" />
</ComboBox>
</Control>
<SetDirectory Id="APPLICATIONFOLDER" Value="[INSTALLCHOICERESULT]" Sequence="execute" />