Reputation: 2035
I have custom action which stores the file location into property at immediate phase. Then I have another action at deffered phase, which reads this property and creates the file:
String configFilePath = session.CustomActionData["configPath"];
String configFileName = session.CustomActionData["configFile"];
...
Everything works so far. At uninstall I would like to remove this file, so I have another deffered action, which executes after removing files. Action works, the problem is that property is empty(session.CustomActionData is empty). Why? I have setted it at immediate phase also when uninstall is happening. And if I can read it at custom setUpConfig action, why I can't read it at custom removeConfig action? I guess one option is to store this value into registry at installing phase and then read it from there when uninstalling. But I would like to know why i can set the property when installing the program, and why it is not setted at uninstalling. The action, which sets the proeprty is executed in both cases.
<CustomAction Id="ConfigFileLocation" Property="setUpConfig" Execute="immediate"
Value="configPath=[WEBSITE];configFile=config_template.asp" />
<CustomAction Id="setUpConfig" BinaryKey="MyCustomAction" DllEntry="configFile"
Execute="deferred" Impersonate="no" Return="check" />
<CustomAction Id="removeConfig" BinaryKey="MyCustomAction"
DllEntry="removeCustomFile" Execute="deferred" Impersonate="no" Return="check" />
<InstallExecuteSequence>
<Custom Action="ConfigFileLocation" After="LaunchConditions" />
<Custom Action="setUpConfig" Before="InstallFinalize"><![CDATA[NOT REMOVE="ALL"]] />
<Custom Action="removeConfig" After="RemoveFiles"><![CDATA[REMOVE="ALL"]] />
</InstallExecuteSequence>
Upvotes: 1
Views: 1111
Reputation: 35796
To pass data to a deferred custom action you must set a Property
with a name that matches the CustomAction/@Id
. You are doing that correctly for the setUpConfig
custom action via the immediate ConfigFileLocation
custom action.
However, the removeConfig
custom action does not have an immediate custom action setting a Property
named removeConfig
.
Ergo the removeConfig
custom action's CustomActionData
property is blank.
Upvotes: 1