Reputation: 105
I have created a simple C# custom action.
[CustomAction]
public static ActionResult MySimpleAction(Session session)
{
MessageBox.Show("It works!");
return ActionResult.Success;
}
<Binary Id="myAction"
SourceFile="MyApp.CA.dll"/>
<CustomAction Id="myActionId"
BinaryKey="myAction"
DllEntry="MySimpleAction"
Execute="deferred"
Return="check" />
<InstallExecuteSequence>
<Custom Action="myActionId"
After="InstallInitialize">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
I got error 2762, when I ran the installation.
When I run
<InstallExecuteSequence>
<Custom Action="myActionId"
Before="InstallFinalize">CHECKBOXCOPYPROP=1</Custom>
</InstallExecuteSequence>
I didn't get the error. Why can't I run after InstallInitialize? How is it run?
Upvotes: 1
Views: 4435
Reputation: 105
You must write:
<CustomAction Id="myActionId" BinaryKey="myAction" DllEntry="MySimpleAction" Execute="immediate" Return="check" />
With Execute="deferred"
it will not work.
Besides this, in CusomAction.config it must be written:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
<supportedRuntime version="v2.0.50727"/>
</startup>
</configuration>
Upvotes: 2
Reputation: 55581
Both after InstallIntialize and before InstallFinalize should work. Take a look at your built MSI using Orca and take a look at the InstallExecuteSequence. Sort it by column Sequence. Does it look to be scheduled correctly? A logfile will also be helpful.
Upvotes: 1