Dynamic ManagedActions

Oct 29, 2016 at 10:26 PM
I'm using WixSharp to build a generic MSI builder that I can reuse for my different software packages by just changing some inputs. I'd like to be able to dynamically define the registry value that needs to be checked prior to installation to make sure a piece of software isn't re-installed. I believe I need to use a ManagedAction for that but I'm unsure about how I can create a custom action in the builder code and then at run time define the variables that the action uses. If that is not possible, is there anyway to create dynamic actions at run time based on user defined values? Thanks.
Oct 31, 2016 at 12:16 PM
Edited Oct 31, 2016 at 10:48 PM
MSI is a static creature so you cannot change the CA at runtime but you can dynamically update the MSI property that is a subject of the condition associated with the action so the action will or will not be executed.

However you don't need to do any of that if you are in a ManagedAction. Have your ManagedAction run before the installation start. Do you checking in it. You are in C# routine so you can be as dynamic as it gets.

ManegedSetup with events is arguably a better fit for the task. See "Managed Setup" sample it shows how to prevent the install on the PC with the name longer than certain length.
Oct 31, 2016 at 4:35 PM
Thanks Oleg. I switched over to ManagedProject and things are working the way I want them to.