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?
You need to create a new C# Custom Action Project for WiX v3 in your solution. Change the function name to a name that fits your function. After that right click on the References Folder on your WiX setup project and choose Add Reference... . Click the tab Projects and choose your custom action Project.
In your CustomAction element set Execute attribute to immediate
. Deferred actions can run only in InstallExecuteSequence between InstallInitialize and InstallFinalize actions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With