How to get a Condition to work (as for deciding whether to install desktop icon) ?

Dec 17, 2016 at 9:31 AM
Edited Dec 17, 2016 at 9:51 PM
For this one, I feel that I am very close. I want to give the user the option of whether to install the shortcut to this program on the Desktop. I am using a ManagedProject.
I see that I can add a Condition to the project thusly:

var project = new ManagedProject( "MyProgram",
                                                     new Dir(@"%Desktop%",
                                                        new ExeFileShortcut("MyProgram", "{INSTALLDIR]MyProgram.exe", "")
Condition = new Condition("INSTALLDESKTOPSHORTCUT=\"YES\"")

and, lo! it does install the Desktop short when I run this installer. And if I set that Property to "NO", it does not.

Now to give the user this option, I created a new Windows.Forms ManagedForm and inserted that into the UI sequence, and that does show up..

''' C#
project.ManagedUI = new ManagedUI();

(UserOptionsDialog is the one I created).

So question to you is this: How, do I set the value of that Property, from within any of the event-handlers of UserOptionsDialog ? I assume that that is where I would need to set it, since that is the code that is executing as the user makes his selections of these various options, right?

Within any of the event-handlers within UserOptionsDialog, I can set
for example, but that does not set the Property.
Within your MsiRuntime class, I do not see any Property properties. ?

Meantime, thank you for building and sharing this wonderful project -- it is indeed being quite useful to me now.
Dec 18, 2016 at 6:23 AM
> How, do I set the value of that Property,
Like this.
Data is a custom data dictionary that Wix# mainaines so user defined properties (not MSI) properties can be kept all the way till (and including) after-install deferred actions. And it has been developed to overcome that ridiculous MSI design flaw that the MSI properties are all destroyed before MSI runtime launches any after-install deferred action. Though in your case you have no use for MsiRuntime.Data as your property is going to be consumed by MSI runtime but not by the ueser-defied routine (e.g. another custom action). Thus you have to assign properties the way WiX intended - by using Session indexer.

By the way <WixSharp>/Samples/ManagedSetup/CustomUIDialog shows exactly your scenario except it is a password string property not boolean as yours.

Unrelated... I see you are battling with CodePlex markup syntax. I know, :), unexplainably they are using two different wiki engines within a single website (discussions and releases). Here you need to use ```C# not {code:c#} tag. And if you mix them together none is working.

On GitHub it's all simple. Single syntax for everything.