I have a problem with my WiX installer in contact with deferred / immediate custom actions. Please excuse my english.
I want to surrender some properties, entered by the user, to a deferred custom action. I know that I need a immediate custom action and "CustomActionData" to do that. I´ve implement it at this way.
The binary:
<Binary Id='myAction' SourceFile='.\TemplateGeneration.CA.dll'/>
The immediate custom action:
<CustomAction Id='Datenuebergabe' Property='DoSomething' Value='InstalllocVar=[INSTALLLOCATION]'/>
The deferred custom action:
<CustomAction Id='TemplateGenerationInstallKey' BinaryKey ='myAction' DllEntry='DoSomething' Impersonate='no' Execute='deferred' Return='check' HideTarget='yes'/>
The InstallExecuteSequence
<InstallExecuteSequence>
<Custom Action="Datenuebergabe" Sequence="1399"/>
<Custom Action="TemplateGenerationInstallKey" Before="InstallFinalize"/>
</InstallExecuteSequence>
Calling the property in the deferred custom action:
string somedata = session.CustomActionData["InstalllocVar"];
TemplateEngineCall(somedata+"templates", "install_key_cmd", somedata+"scripts", "install_key.cmd");
My problems: If I try to install my program it breaks. With this code i only can surrender one property, but I need to commit more than one.
For information: When I have a look at the log file, there´s a System.Collections.Generic.KeyNotFoundException while the custom action call.
Why doesn´t this work? Well, I need the deferred custom action to write into the "program files folder". Because of the needed rights, the deferred custom action is required and the immediate custom action executed before the deferred should help to handle the properties. Is it possible to do that?
I hope you understand what are my problems and possible you can try to help me.