如何覆盖自定义操作中出现的错误消息 [英] How can I overwrite an error message occured on custom action

查看:64
本文介绍了如何覆盖自定义操作中出现的错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过自定义操作触发了c#应用程序:

I trigger an c# application by an custom action:

在失败的情况下,我的应用程序告诉Install Shield使用退出代码中止安装过程:

On failing condition, my application tells Install Shield to abort the installation process using an exit code:

static void Main(string[] args)
{
    if(false)
    {
        Environment.ExitCode = 1;
    }
}

使用这种方法,Install shield的安装程序会显示一条错误消息,如预期的那样:

Using this approach, Install shield´s setup displays an error message like expected:

如何用自定义文字覆盖该错误消息?

How can I overwrite that error message by a custom text?

推荐答案

在两行之间阅读时,您的自定义操作似乎启动了EXE.如果是这样,那么您将无法做您所要求的.您可以在返回非零退出代码之前显示来自EXE的消息,但Windows Installer仍会显示错误1722消息.

Reading between the lines here, it appears your custom action launches an EXE. If that is so, there is no way to do what you ask. You could show a message from your EXE before returning a non-zero exit code, but then Windows Installer would still show the Error 1722 message.

如果相反可以从DLL运行函数,则可以有更多选择.您可以设置属性(假设这是立即模式操作),而不必返回错误,并且可以使用这些属性做更多的事情,例如显示另一个对话框,或者退出安装而不会出现Error 1722消息.我认为限量版中没有所有必需的配置选项-您当然不能在LE中编辑对话框-因此,要完成所有这些操作,您必须更改为功能更强大的工具(包括专业版或选项)来自其他供应商).

If you can instead run a function from a DLL, you have more options. Instead of returning errors, you'd be able to set properties (assuming this is an immediate mode action), and could use those properties to do further things, such as show another dialog, or exit the installation without the Error 1722 message. I don't think all the necessary configuration options are available in the limited edition - you certainly cannot edit dialogs in LE - so to do all of that, you would have to change to a more capable tool (including the Professional edition, or options from other vendors).

这篇关于如何覆盖自定义操作中出现的错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆