自定义操作session.message未显示消息框

时间:2013-09-24 15:49:08

标签: c# wix custom-action

我正在使用Wix创建一个基于MSI的安装程序。

我的自定义操作声明是这样的......

<Binary Id="CustomActions" SourceFile="DLLs\CustomActions.CA.dll" />

<CustomAction Id="CheckPath" Return="check" Execute="immediate" BinaryKey="CustomActions" DllEntry="CheckPath" />

在WixUI_InstallDir对话框UI下,

<UI Id="WixUI_InstallDir">
    .....
    <Publish Dialog="SelectDirDlg" Control="Next" Event="DoAction" Value="CheckPath" Order="2">1</Publish>
    .....
</UI>

在C#文件中,

[CustomAction]
public static ActionResult CheckPath(Session session)
{
      Record record2 = new Record();
      record.FormatString = "The path that you have selected is invalid!";
      session.Message(InstallMessage.Error | (InstallMessage)MessageButtons.OK, record);
      return ActionResult.Success;
}

当用户选择无效路径时,我希望通过上面的自定义操作显示一个消息框。但是没有显示消息框。

我做错了什么?

1 个答案:

答案 0 :(得分:6)

通过DoAction控件事件触发的自定义操作无法显示消息框。请参阅http://msdn.microsoft.com/en-us/library/windows/desktop/aa368322%28v=vs.85%29.aspx

相关问题