Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX Toolset How to Set a Property

This seems like it should be intuitive, but so far its been anything but. How do I simply set a property I have defined in my product.wxs when my custom dialog first opens?

My Property is called "Port" which is initialized as blank. I have another called "df_Port", which I set to "8080". (These are set in my Product.wxs) When my Custom Dialog opens I want to set "Port" to "df_Port". I also have an Edit control on the dialog whose "Property" setting is set to "Port". So obviously the User should be able to update Port, but if they hit the "Back" button, but eventually come back to this dialog, the default value of the Edit Control should go back to "8080"

I have tried SetProperty, but it requires a Before or After property, and I have no clue on this. I have also tried to create a CustomAction, but this hasn't worked either:

<CustomAction Id="caPort" Property="Port" Value="[df_Port]"/>

The control shows as blank, instead of "8080"

I am using Wix 3.9 R2

like image 576
David P Avatar asked Jun 05 '15 14:06

David P


People also ask

What is WiX toolset used for?

Windows Installer XML Toolset (WiX, pronounced "wicks"), is a free software toolset that builds Windows Installer packages from XML.

What is WiX Visual Studio?

The Visual Studio WiX toolset allows you to easily create WiX projects, edit WiX files using IntelliSense, and compile/link your project within the Visual Studio IDE. For WiX project types, see WiX Project Types.


1 Answers

Nobody answered or commented on my question. However, after much trial and error I figured out a solution. I figured I'd put it up here in case somebody else had the same problem.

1) First, I have to name properties as all Uppercase. So in my product.wxs I declare:

<Property Id="DF_PORT" Value="8080" Secure="yes"/>
<Property Id="PORT" Secure="yes"/>

2) I then add a publish tag and attach to Next button of dialog preceding my custom configuration dialog:

<Publish Dialog="PrecedingDialogName" Control="Next" Property="PORT" Value="[DF_PORT]">1</Publish>

3) In my custom dialog, I just bind an Edit control to the PORT property:

<Control Id="Port" Type="Edit" X="130" Y="88" Width="60" Height="16" Property="PORT" Text="{\WixUI_Font_Normal}" Integer="yes" RightAligned="yes" />

The control will display the default value. If I edit the value, but then hit the "Back" button, Step 2 will reload the default value, instead of remembering what the User had typed.

After working with WIX Toolset for a couple of weeks now, I can honestly say that this is one of the worst and most unintuitive development pieces I have ever seen!

like image 175
David P Avatar answered Sep 29 '22 08:09

David P