h353655
Posts: 45
Joined: Wed Jun 21, 2017 2:51 pm

Merge module - property values blank in custom step

I have a merge module which runs a temporary file with some parameters. But when I run, they appear blank. I have added a small vbs script to log the property values, and I can see the merge module has these values set. But in the command line in my custom build step RunCertificateInstaller, the properties are blank.

Code: Select all

Function WriteToLog
Const MsgType = &H04000000
Set rec = Installer.CreateRecord(1)
rec.StringData(1) = CStr("Supplied parameters: AuthCode=[") + CStr(Session.Property("AUTHCODE")) + CStr("], Applications=[") + CStr(Session.Property("APPLICATIONS")) + CStr("], Additional Params=[") + CStr(Session.Property("ADDITIONALCERTIFICATEPARAMS")) + CStr("]")
'rec.StringData(1) = CStr("Any type of message can be wrote here")
Session.Message MsgType, rec
WriteToLog = 0
End Function
Another little fun thing: when I use the merge module, the CI_xxx parameters must have a property matching (AUTHOCDE, APPLICATIONS etc) as value, or blank (empty string or null) is passed. Not sure why that is so. I wanted to use a fixed text for one of them.


EDIT: The ONLY (and somewhat uncool) way I could make this work was to have a couple of "Set Installer Property" custom actions in the installer's Custom Actions. I set [MYPROP].<merge module GUID> to [INSTALLER_PROP] and that worked. But I think this is a bug, as that kind of defies the purpose of the parameters one can assign to a merge module (and which worked just fine for the VB Script).
Attachments
BiometricSolutions.Authentication.Installation.ClientCertificateInstall.MergeModule.aip
Revised version, only minor changes
(36.54 KiB) Downloaded 61 times
ClientCertificateInstall.aip
Test installer project.
(28.16 KiB) Downloaded 63 times
BiometricSolutions.Authentication.Installation.ClientCertificateInstall.MergeModule.aip
(36.42 KiB) Downloaded 62 times
Eusebiu
Posts: 4941
Joined: Wed Nov 14, 2012 2:04 pm

Re: Merge module - property values blank in custom step

Hi,

I've looked at the configuration of your product, but I could not see where you set the properties that you send to the "RunCertificateInstaller" custom action. Do you set them in the main package (where the merge module is added) or from the command line?

If so, can you please send me the main project and a verbose log of the installation, so I can investigate them, too? You can send them to our support email address.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
h353655
Posts: 45
Joined: Wed Jun 21, 2017 2:51 pm

Re: Merge module - property values blank in custom step

I have added a verbose log and some screenshots. I hope that makes things more clear.

In this test I removed my custom build steps on the installer's side to set [PROP].<mergemodule GUID> so we can see the error again.
Attachments
Set Variables, merge module side.png
Set Variables, merge module side.png (120.24 KiB) Viewed 1684 times
Set Variables, installer side.png
Set Variables, installer side.png (110.63 KiB) Viewed 1684 times
ClientCertificateInstall.log
(308.08 KiB) Downloaded 60 times
h353655
Posts: 45
Joined: Wed Jun 21, 2017 2:51 pm

Re: Merge module - property values blank in custom step

For the log, note lines 821 and 825.
Parameters arrive as text
-AuthCode [AUTHCODE] -Applications [APPLICATIONS]
That only happended after I gave them a default value. Before they were just blank, giving me
-AuthCode -Applications
Eusebiu
Posts: 4941
Joined: Wed Nov 14, 2012 2:04 pm

Re: Merge module - property values blank in custom step

Hi,

Thank you for all the details.

Please note that the values for the configurable properties of a merge module are set at build time (when the MSM is integrated into the MSI) and setting them using properties from the MSI package is not possible.

You can see similar discussions with additional details in the "Merge Module Parameters" and the "pass parameter to merge module" threads.

I'm afraid that this is the Windows Installer design for Merge Modules and therefore the only method to set merge module's properties to the value of properties from the main MSI package is to use "Set installer properties" as you've already tried.

If you have other questions, just let me know.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
h353655
Posts: 45
Joined: Wed Jun 21, 2017 2:51 pm

Re: Merge module - property values blank in custom step

Oh I have questions all right... :-)

This makes little sense.

1) I can set a variable in an installer at run time, and that works.
2) I can pass values via properties to a merge module
3) I can write out those same transferred values in a vbscript at run time.

Also, if I set it in the dirty way that I did (PROPTERTY.<merge module GUID> = Installer's property) I *can* transfer values to the merge module.

No, this is clearly a bug, and I would appreciate it being fixed.
Eusebiu
Posts: 4941
Joined: Wed Nov 14, 2012 2:04 pm

Re: Merge module - property values blank in custom step

Hi,

Please note that the properties that you write out through the VBScript are the properties from the MSI package, not from the merge module (they have the same name). If you want to write out the properties from the merge module, you need to use the "PropertyName.GUID" naming in your VBScript.

Even if the VBScript custom action is present in your merge module, it looks under the whole installation session and takes the property with the exact name you specified (e.g. Session.Property("AUTHCODE")).

As I mentioned in my previous reply, the values for the configurable properties are written in the MSI table at build time and those configurable settings are not re-evaluated during the installation. This was reported to us many years before in other threads and we investigated this and found that this is how Windows Installer works with configurable merge modules.

During the installation you may set a new value for the "AUTHCODE" property on your dialogs, but in order for the "AUTHCODE.GUID" property to also be updated, you need a custom action (e.g. Set installer property) that sets it after the new value was set for the "AUTHCODE" property. Or you can directly update the "AUTHCODE.GUID" property on your dialogs by assigning it to the desired input box.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
h353655
Posts: 45
Joined: Wed Jun 21, 2017 2:51 pm

Re: Merge module - property values blank in custom step

Is there any nicer and cleaner way of doing this? Passing values via the "Configure Merge Module" dialog seemed like a nice and clean way of passing data. Needing a custom build step for each property with PROPERTY.GUID is super ugly, and not something I could expect a colleague or third party using the merge module to remember. Preferably, I'd like to do as much as possible in the merge module so the consumer of the merge module will only have to do and remember as little as possible. Using PROPERTY.GUID seems a bit like getting a DLL and being told it only works if you set a certain address in memory to a given value.
Eusebiu
Posts: 4941
Joined: Wed Nov 14, 2012 2:04 pm

Re: Merge module - property values blank in custom step

Hi,

I'm afraid that I'm not aware of another way of doing this. Over the past years there were some discussions about this on the internet, but no other solution was found. Unfortunately this is the way Windows Installer works with merge modules.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”