从对话框调用 CustomAction 时出现 WiX 安装错误 2762 [英] WiX install error 2762 while invoking a CustomAction from dialog
问题描述
我是初学者,开始学习 WiX.我想在安装过程中捕获、验证和注册用户详细信息.我创建了一个对话框来捕获用户注册并在用户单击下一步"后调用自定义操作.
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'.
但在这里我收到安装程序错误 2762.虽然错误描述说必须在 InstallInitialize 和 InstallFinalize 之间安排操作",但我不知道如何解决这个问题.
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.
这是我的 XML 脚本:
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;
}
如果在InstallExecuteSequence"中使用自定义操作,则工作正常.我无法找出问题所在,我删除了自定义对话框并使用以下简单调用来调用自定义操作.但我最终遇到了同样的错误.
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?
推荐答案
在您的 CustomAction 元素中,将 Execute 属性设置为 immediate
.延迟操作可以仅在 InstallInitialize 和 InstallFinalize 操作之间的 InstallExecuteSequence 中运行.
In your CustomAction element set Execute attribute to immediate
. Deferred actions can run only in InstallExecuteSequence between InstallInitialize and InstallFinalize actions.
这篇关于从对话框调用 CustomAction 时出现 WiX 安装错误 2762的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!