I am a beginner, started learning WiX. I want to capture and validate and register user details during the installation process. I have created a dialog to capture user registration and invoking a custom action once user clicks on 'Next'.
But here I am getting installer error 2762. Though the error description says that "The action must be scheduled between InstallInitialize and InstallFinalize", I am not able to figure out how to resolve this problem.
Here is my XML script:
<Binary Id="mycustom"
SourceFile="..\CustomAction1\bin\Debug\CustomAction1.CA.dll" />
<CustomAction Id="myCustomValidate"
BinaryKey="mycustom"
DllEntry="ValidateCustomAction"
Execute="deferred"
Return="check">
</CustomAction>
<UI>
<UIRef Id="WixUI_Mondo" />
<Dialog Id="UserRegistrationDlg"
Width="370"
Height="270"
Title="[ProductName] [Setup]"
NoMinimize="yes">
..
..
..
<Control Id="Next"
Type="PushButton"
X="236"
Y="243"
Width="56"
Height="17"
Default="yes"
Text="[ButtonText_Next]">
<Publish Event="ValidateProductID" Value="0">1</Publish>
<Publish Event="DoAction" Value="myCustomValidate">1</Publish>
<Publish Event="SpawnDialog" Value="InvalidRegDlg">PIDACCEPTED = "0"</Publish>
<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID AND PIDACCEPTED = "1"</Publish>
</Control>
</Dialog>
</UI>
Following is the custom action code I used.
[CustomAction]
public static ActionResult ValidateCustomAction(Session session)
{
return ActionResult.Success;
}
Custom action is working fine if used in "InstallExecuteSequence". I am not able to figure out the problem, I removed the custom dialog and used the following simple call to invoke custom action. But I ended up with the same error.
<Publish Dialog="LicenseAgreementDlg"
Control="Next"
Event="DoAction"
Value="myCustomValidate">1</Publish>
I am sure I am doing something silly here, but couldn't figure out. What is the solution?
In your CustomAction element set Execute attribute to immediate
. Deferred actions can run only in InstallExecuteSequence between InstallInitialize and InstallFinalize actions.