会话.消息未在产品安装屏幕上显示弹出消息



我有一个customActions类:

public static ActionResult Register(Session session)
{
try
{
Do SOmething
}
catch (Exception ex)
when (ExceptionManager.catchGenericExcetion(ex))
{
var responseMessage =ex.ResponseMessage;
if (responseMessage.Contains("Maximum apps created"))
{
session.Log("maximum limit reached");
using Record record = new Record(0);
record[0] = "This is an error!Max apps reached";
session.Message(InstallMessage.Error, record);
}
return ActionResult.Failure;
}
return ActionResult.Success;
}
}

在这里,我的UI没有显示任何与会话相对应的弹出窗口。消息(InstallMessage.Error,记录(;但是,在MSI日志中,我可以看到打印的消息:达到的最大限度

MSI (s) (30!F4) [21:26:05:047]: Product: MyApp -- This is an error!Max apps reached

有人能帮我解释为什么我无法在UI上看到这条消息吗?我希望它在安装过程中显示在最终用户的UI上。

调试或发布消息 :不确定您真正需要什么-您只是在调试,还是想在安装过程中为实际的最终用户交互式显示一些内容?

调试 :如果正在调试:在显示自定义操作的消息框后,将调试器附加到自定义操作,如下所示。然后你可以正确地逐步通过代码-视频快速演示(也许这已经为你工作了(:

using System.Windows.Forms;
<..>
[CustomAction]
public static ActionResult TestCustomAction(Session session)
{
MessageBox.Show("Hello from TestCustomAction");
return ActionResult.Success;
}

Session.Message:我还没有真正使用过这个概念(我喜欢将信息放入日志中,而不是向最终用户显示(,但我发现它有效(从这里清除-"prepared search"(:

[CustomAction]
public static ActionResult TestCustomAction(Session session)
{
Record record = new Record(0);
record[0] = "This is an error! Max apps reached";

session.Message(InstallMessage.User | (InstallMessage)MessageButtons.OK | (InstallMessage)MessageIcon.Information, record);
return ActionResult.Success;
}

最新更新