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" />
Related
My problem is that I would like to allow the user to install an optional component group based on a radio-button selection.
The radio button and the Condition specified in the Feature are both bound to a Property called "InstallType". InstallType will be set to 1 to install only "client" files, but 2 to install both client and server files.
The conditional installation works correctly, based on the initial value of InstallType, but when the user changes InstallType the new value is ignored.
Here is the code in the dialog:
<Fragment>
<Property Id="InstallType" Value ="1"/>
<UI>
<Dialog
Id ="InstallationTypeDlg" Width ="370" Height ="270" Title ="Test Install Type" NoMinimize ="no">
<Control Id ="Text1" Type ="Text" Text ="Choose Install Type:" Height="17" Width="200" X="10" Y="15" />
<Control Id ="InstallTypeRadioGroup" Type ="RadioButtonGroup" Property="InstallType" X="50" Y="35" Height ="40" Width ="300">
<RadioButtonGroup Property ="InstallType">
<RadioButton Value ="1" Text ="ClientOnly" Height ="17" Width ="90" X="0" Y="10" />
<RadioButton Value ="2" Text ="ClientAndServer" Height ="17" Width ="90" X="0" Y="10" />
</RadioButtonGroup>
</Control>
</Dialog>
</UI>
</Fragment>
And here is the code in Product.wxs:
<Feature Id="ClientOnly" Title="Client Only" Level="1">
<ComponentGroupRef Id="ClientProductComponents" />
</Feature>
<Feature Id="ClientAndServer" Title="Client And Server" Level="0">
<ComponentGroupRef Id="ServerProductComponents" />
<Condition Level="1" >
<![CDATA[InstallType = "2"]]>
</Condition>
</Feature>
As shown, the code will always install the Client files, but never the Server.
If InstallType is initialized as "2", both Component Groups are installed, as expected.
I can force the outcome by hard-coding "true" or "false" in the condition evaluation.
The only thing that doesn't seem to be working is that toggling the radio button has no effect on InstallType as seen inside Product.wxs.
If I put a Text box in a dialog downstream of the radio-button dialog, I can see that InstallType contains the correct value.
I am using WIX 3.10 and VS2015.
Anyone have any idea what's wrong?
All responses appreciated.
Thanks,
Warren
I have a wix install file defined with a Property, IniFile inside a Component, and a custom dialog with a RadioButtonGroup that changes the value of said property. The property is used as a value for one of the IniFile's entries. Problem is it seems that IniFile value gets resolved prior to the property getting set via the radio buttons, as I always get the property's default value in my ini file. So my question is - how do I get it to resolve the IniFile's value (a property) later, after it's been altered.
Here's a rough outline of what I have:
<Property Id="SlpStatic" Value="STATIC" />
.
.
<Component Id="UpdateSlpStatic" Guid="aa8867b4-129c-42f3-85cc-06b588c29a40" Directory="TARGETDIR">
<CreateFolder />
<IniFile Id="IniSlpStatic" Action="addLine" Section="Overrides" Name="config.ini" Directory="INSTALLDIR" Key="type" Value="[SlpStatic]" />
</Component>
.
.
<Control Type="RadioButtonGroup" Property="SlpStatic" Id="SlpStaticChoice" Width="200" Height="42" X="112" Y="68">
<RadioButtonGroup Property="SlpStatic">
<RadioButton Text="SLP" Height="17" Value="SLP" Width="300" X="0" Y="0" />
<RadioButton Text="Static" Height="17" Value="STATIC" Width="200" X="0" Y="25" />
</RadioButtonGroup>
</Control>
I know that the SlpStatic property is getting set properly (I have another control that enables/disables based on its value), so the problem is that IniFile's value is getting resolved too early.
I have an issue with Wix where an Edit control is not setting a property. I am using the property in a XmlFile node to modify an .xml file copied to the install location. The value of the property IS being correctly set in the file (the default value is being used) but I cannot seem to set the property with a value from the Edit control. This is driving me nuts.
<Fragment>
<Property Id="CUSTOMERNAMEPROPERTY" Value="Some default value" Secure="yes" />
<UI>
<Control Id="CustomerNameEdit" Type="Edit" X="120" Y="75" Width="220" Height="18" Property="CUSTOMERNAMEPROPERTY" Text="{80}" Indirect="yes" />
</UI>
</Fragment>
What is wrong with this?
Thanks
The Indirect attribute should be set to "no". Edit controls should reference their properties directly.
Also, make sure that you use a public property (only uppercase letters in its name). Private properties use their default values during install.
Try to declare your property inside <UI> element:
<Fragment>
<UI>
<Property Id="CUSTOMERNAMEPROPERTY" Value="Some default value" Secure="yes" />
<Control Id="CustomerNameEdit" Type="Edit" X="120" Y="75" Width="220" Height="18" Property="CUSTOMERNAMEPROPERTY" Text="{80}" Indirect="yes" />
</UI>
</Fragment>
Dialog.wxs
<UI>
<Dialog Id="UserRegistrationDlg" ... >
<Control Id="NameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="NameValue" Text="{80}" />
</Dialog>
<UI>
In Product.wxs I created a property
<Property Id="NameValueProperty" Value="NameValue" />
Then, as I understood, I have to use [NameValueProperty] for getting value but id doesn't work ... What's wrong?
A verbose log file should show you the changes to the properties. Very useful when tracking down these sort of things. In this case, your example code is actually setting a Property called NameValue to the value in the edit box. If you want to default the value in the edit box then you would do something like:
<Property Id="NameValue" Value="Show this in the edit box" />
And to reference the value you'd use [NameValue]. Alternatively, you could change your code to be:
<UI>
<Dialog Id="UserRegistrationDlg" ... >
<Control Id="NameEdit" Type="Edit" X="45" Y="85" Width="220"
Height="18" Property="NameValueProperty" Text="{80}" />
<Dialog>
<UI>
You generally want to use a Secure Custom Property in this situation. This is a property that is both Public (i.e. CAPS ) and marked as Secure A value is only required if you want there to be a default value.
<Property Id="MYPROPERTY" Secure="yes" />
I have a WiX file that includes this snippet:
<CustomAction Id="DownloadCache" FileKey="CACHEDOWNLOADER.EXE" ExeCommand="/v" Execute="deferred" Return="ignore"/>
<UI>
<Dialog Id="ExitDialog" Title="Product Installer" Height="60" Width="250">
...
</Dialog>
<Dialog Id="FatalErrorDialog" Title="Product Installer" Height="60" Width="250">
...
</Dialog>
<TextStyle Id="DefaultFont" FaceName="Arial" Size="10" />
<Property Id="DefaultUIFont" Value="DefaultFont" />
<InstallUISequence>
<Custom Action="DownloadCache" After="ExecuteAction">(NOT Installed) AND (Not REMOVE)</Custom>
<Show Dialog="ExitDialog" OnExit="success" />
<Show Dialog="FatalErrorDialog" OnExit="error" />
</InstallUISequence>
</UI>
<InstallExecuteSequence>
<Custom Action="DownloadCache" After="WriteRegistryValues">(NOT Installed) AND (Not REMOVE)</Custom>
</InstallExecuteSequence>
The issue is, the resulting .MSI does NOT contain an InstallUISequence table.
I went through the tutorial Events and Actions and the above seems correct. I'm definitely missing something here. How can I fix it?
There must be more than meets the eye here. Even the simplest fragment below will generate an InstallUISequence table with the bare minimum actions of ValidateProductID, CostInitialize, FileCost, CostFinalize and ExecuteAction. No actual UI elements per se, but that's another issue.... (Are Dialogs Optional Now??)
<Wix...>
<Product...>
<Package.../>
</Product>
</Wix>