我使用 Visual Studio 2010 为我的项目创建带有 .NET Framework 4.0 的安装包。我使用 Installer 类以及使用 .NET Framework 4.0 构建的 DLL 创建自定义操作。我的安装包已成功安装。
如果我删除我的包,然后删除 .NET Framework 4,一切都会正常。
但是,如果我删除 .NET Framework,然后删除安装包,则会收到错误:“1001 InstallUtilLib.dll 未知错误”。我认为我无法删除安装包的原因是 msiexec 将调用我的自定义操作,即使用 .NET Framework 4.0 的 Installer 类,而 .NET Framework 4.0 之前已被删除 ->无法调用安装程序 DLL 并返回错误 -> 删除 MSI 失败。
请帮助我如何避免此错误或如何忽略此自定义操作的错误代码。谢谢。
I use Visual Studio 2010 to create a setup package with .NET Framework 4.0 for my project. I create a custom action using Installer class with DLL built with .NET Framework 4.0. My setup package is installed successfully.
If I remove my package and after that removing .NET Framework 4, everything is ok.
However, If I remove .NET Framework, after that I remove my setup package, I get a error: "1001 InstallUtilLib.dll unknown erro" . I think the reason I can't remove my setup package because msiexec will call my custom action which is Installer class using .NET Framework 4.0 while .NET Framework 4.0 is removed before -> Installer DLL can't be called and return a error ->removing MSI failure.
Please help me how to avoid this error or how to ignore the error code of this custom action. Thanks.
发布评论
评论(3)
您可以尝试以下操作:
Visual Studio 不直接支持此操作。
You can try this:
Visual Studio doesn't support this directly.
您可以通过设置 Framework 4.0 的启动条件来避免此错误,这样每当启动安装程序(用于安装或卸载)时,它都会首先检查 Framework 4.0
You can avoid this error by having a launch condition for Framework 4.0, so that when ever the setup is launched (for install or uninstall) it first checks for framework 4.0
mrnx 的答案对我有帮助,但我想我会用我最终所做的事情来扩展这个答案。就我而言,我在多个程序中包含一个驱动程序,其中驱动程序始终返回 1 而不是 0。
基于 mrnx 打开 MSI 文件并查看 CustomAction 表,我发现我的自定义操作的类型都是“3090”。要设置 msidbCustomActionTypeContinue 标志,我必须添加 64,这意味着将值更改为 3154。
由于我想在构建过程中自动执行此操作,所以我发现了这个 问题,解释了如何创建 MSI 转换。此解决方案有效,但它无法在项目之间移植,因为转换仅适用于一个 MSI 文件。相反,我发现从设置项目构建后步骤调用的简单 VB 脚本适用于各种 MSI 项目:
用法(设置为项目属性的PostBuildEvent):
mrnx's answer helped me, but I thought I would expand on that answer with what I ended up doing. In my case, I was including a driver in multiple programs, where the driver always returns 1 instead of 0.
Based on the mrnx's procedure to open the MSI file and view the CustomAction table, I found that my custom actions all had the type "3090". To set the msidbCustomActionTypeContinue flag, I had to add 64, which meant changing the value to 3154.
Since I wanted to automate this in my build process, I found this Question, which explained how to create an MSI transform. This solution works, but it wasn't portable between projects since the transform would only work for the one MSI file. Instead, I found that a simple VB script called from the setup project post-build step works for various MSI projects:
Usage (set to PostBuildEvent of Project Properties):