简体   繁体   English

如何使自定义操作返回非零

[英]How to make a custom action return non-zero

I'm working with the .NET Installer, and using a custom action executable file. 我正在使用.NET安装程序,并使用自定义操作可执行文件。 According to this documentation , if it fails it must return non-zero. 根据此文档 ,如果失败,则必须返回非零。 However this is new ground for me and I do not know how to make an executable "return" a value. 但是,这对我来说是新天地,我不知道如何使可执行文件“返回”值。

How does an custom action executable return a non-zero value and abort the install? 自定义操作可执行文件如何返回非零值并中止安装?

If it is your executable, simply add an exception handler (try/catch block) and return (Environment.Exit(-1) -1 in the catch block, 0 otherwise. 如果它是可执行文件,则只需添加一个异常处理程序(try / catch块),然后在catch块中返回(Environment.Exit(-1)-1,否则返回0。

If it is a third party, then you have less options. 如果是第三方,那么您的选择就少了。 Try checking their manual or contact them directly. 尝试查看其手册或直接与他们联系。

Perhaps you can run the executable and see what values it returns from the command line. 也许您可以运行该可执行文件,并查看其从命令行返回的值。 You may not have to do anything at all other than consuming it in your installer. 除了在安装程序中使用以外,您可能根本不需要执行任何其他操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM