I want to use an MSI installer property in a condition message in a WiX installer. This MSI property is set by a C++ custom action. I can set and get the same MSI property and value before calling the condition message, but it is failing when I use it in condition message.
My condition message is looks like
WiX (Windows Installer XML) is a set of tools that allows the creation of Windows Installer-based deployment packages for your applications. Microsoft uses WiX to deploy its own software, including Office and Visual Studio. Sending errors that stop the installation. In our case, the install condition uses RegistrySearch to check if the.
Here this MyProperty is a string and returns either YES or NO, and it is set by C++ CA and this condition is failing in both cases. But I want to show this message only when the MyProperty is set to 'NO'.
So how do I use my custom MSI property in a condition message that was set by a custom action?
Peter MortensenI would try to UPPERCASE the property MyProperty
to make it a PUBLIC property, and then I would also declare it in your WiX source via a Property Element and set the Secure attribute
to Yes
and see if that helps. The WiX markup:
I would also retrieve the property after you set it in your C++ custom action to determine if it has been set correctly (it could be blank). Using VBScript you can retrieve the property very easily. Here is a sample (VBScript helps avoid any compilation and you can embed the source in the custom action - great for testing purposes - and use it only for testing purposes):
As a WiX element, something like this (can't test right now - give it a try - remember to insert in the InstallUISequence
or InstallExecuteSequence
):
I believe this should help you sort out what the problem really is.
You can use the WiX Property element to test the condition by hard coding a value outright (in case the C++ code set property call is the problem). The following should make your launch condition evaluate to false (triggering the message you specified to show):
Stein ÅsmulStein ÅsmulCoding questions are better placed on https://stackoverflow.com/
The answer to this question is a lot more complicated than it should be. Please check if this post gets you going in the right direction, and I will check back to see if your problem was solved: https://stackoverflow.com/questions/3252448/visual-studio-deployment-project-customactiondata
In addition to what that question mentions, make sure your property is listed in the delimited list of 'secure properties' in the SecureCustomProperties Property.
All this complexity stems from Windows Installer's complex 'elevated priviledges' concept that allows non-administrator users to install with elevated rights at times. For this to work no properties can be accessed directly in the transaction that runs with elevated rights, and you must specifically write their value into the execution script and retrieve them in a rather exotic way as you will see in the linked articles. It involves reading back a property called CustomActionData.
Finally, and importantly; post on stackoverflow.com also. WiX may have a more advanced way to deal with this complexity at this stage that I am not aware of. Some sort of automagic.