文件或程序集无法加载错误

发布于 2024-09-01 06:41:07 字数 1244 浏览 11 评论 0原文

我正在开发一个创建 .msi 文件的安装程序。有一个与之相关的 CustomAction 程序,它是用 C# 编写的。此 CustomAction 程序中创建了三个 COM 对象引用,这是该程序正常工作所必需的。它们如下。

  1. 活动 DS IIS 命名空间提供 (C:\Windows\System32\inetsrv\adsiis.dll)
  2. Windows 脚本宿主对象模型 (C:\Windows\System32\wshom.ocx)
  3. NetFwTypeLib (C:\Windows\System32\FirewallAPI.dll)

作为添加信息,以下是我在程序中使用这些 DLL 的任务。

  1. 为特定文件类型设置 MIME 设置。
  2. 创建文件夹的桌面快捷方式。
  3. 将程序注册为防火墙例外

现在,这是我的问题。当我重建 C# 程序并从 Visual Studio 中执行 CustomAction 程序时,它工作正常,我可以轻松完成上述三个任务。但是,当我实际构建 .msi 并尝试执行它并在我的系统上安装该程序时,它会出现错误。我使用的是日语操作系统,因此它会给出日语错误,因此我会尽力将错误消息翻译成英语。错误是这样的:

*

文件或程序集'Interop.IISOle, 版本 = 1.0.0.0,文化 = 中立, PublicKeyToken = null',或其之一 无法加载依赖项。 找不到指定的文件。

*

给出此特定错误消息是因为它与第一个 dll (adsiis.dll) 相关,因为它包含 IISOle 命名空间。同样,它给出了与我在程序中引用的所有三个 COM 对象相关的错误消息。现在我可以从中了解到的是,不知何故,当此代码位于 .msi 文件内时,它无法找到适当的 COM 对象。我真的很困惑为什么会发生这种情况,因为当我尝试安装该程序时,即使在我用来编写 CustomAction 的同一台机器上,安装程序也会给出相同的错误。有趣的是,它可以在 Visual Studio Interface 中完美执行。请帮我解决这个问题。提前致谢!

请注意,我正在使用 Windows Vista Business,但我需要我的安装程序能够安装在从 Windows Server 2003 到 Windows 7 的各种 Windows 操作系统上。

I am working on a Setup program which creates a .msi file. There is a CustomAction program associated with it which is written in C#. There are three COM object references made in this CustomAction program which are necessary in order for it to work. They are as follows.

  1. Active DS IIS Namespace Provide (C:\Windows\System32\inetsrv\adsiis.dll)
  2. Windows Script Host Object Model (C:\Windows\System32\wshom.ocx)
  3. NetFwTypeLib (C:\Windows\System32\FirewallAPI.dll)

As added information, following are the tasks I use these DLLs in my program for.

  1. To set MIME settings for a particular file type.
  2. To create a desktop shortcut to a folder.
  3. To register a program as a firewall exception

.

Now, here is my problem. When I rebuild the C# program and execute the CustomAction program from within Visual Studio, it works fine and I can get the above three tasks done like a charm. However, when I actually build the .msi and try to execute it and install the program on my system, it gives an error. I'm using a Japanese OS so it gives the error in Japanese so I'll try to translate the error message in to English as best as I can. The error is something like this:

*

File or assembly 'Interop.IISOle,
Version = 1.0.0.0, Culture = neutral,
PublicKeyToken = null', or one of its
dependencies could not be loaded.
Cannot find the file specified.

*

This particular error message is given because it relates to the first dll (adsiis.dll) because it is the one which contains the IISOle namespace. Similarly it gives error messages relates to all the three COM objects which I made references to from my program. Now what I can understand from this is, somehow when this code is inside the .msi file it cannot find the appropriate COM objects. I'm really confused why this happens as the Setup gives the same error when I try to install the program even on the same machine which I used to code the CustomAction. Funnily it executes flawlessly from withing Visual Studio Interface. Please do help me with this. Thanks in advance!

Note that I'm working on Windows Vista Business, but I need my Setup to be able to install on a variety of Windows OS ranging from Windows Server 2003 to Windows 7.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ㄟ。诗瑗 2024-09-08 06:41:07

今天刚遇到这个。转到“打开或关闭 Windows 功能”并查看 IIS 下的所有内容,包括 IIS 6 内容。

确保选中“Internet 信息服务”>“IIS 元数据库和 IIS 6 配置兼容性”功能。 “网页管理工具”> “IIS 6 管理兼容性”。

Just encountered this today. Go to "Turn Windows features on or off" and scope out everything under IIS, including the IIS 6 stuff.

Make sure that the feature "IIS Metabase and IIS 6 configuration compatibility" is checked, found under "Internet Information Services" > "Web Management Tools" > "IIS 6 Management Compatibility".

伪心 2024-09-08 06:41:07

安东,我终于知道出了什么问题了。

例如,当我引用 dsiis.dll 时,Visual Studio 会在我的 CustomAction 程序的 bin 目录中放置一个 Interop 模块,即 Interop.IISOle.dll。也可以在其中找到 CustomAction.exe。当我引用其他两个 COM 对象时,它会执行相同的过程; wshom.ocx 和 FirewallAPI.dll。但我使用 Wix 编写的实际安装程序将此 CustomAction.exe 复制到其他目录,并且 .msi 使用该特定的 CustomAction.exe 文件。出现此问题是因为在那里找不到 Interop.IISOle.dll(以及其他文件)。 (错误消息似乎从一开始就说明了我需要寻找的内容;我很愚蠢地没有寻找它,而是认为可能存在更大的问题)

所以这就是我所做的。我指示 Wix 项目将这些 Interop DLL 文件复制到安装程序使用的 CustomAction.exe 所在的位置。这样问题就这么轻松解决了。

对于 Wix,我完全是个新手,而且由于某些原因,我们需要对 2 和 3 使用 CustomAction。

Anton, finally I found out what was wrong.

When I reference, for instance, dsiis.dll then Visual Studio places an Interop module, namely Interop.IISOle.dll inside the bin directory of my CustomAction program. Which is where the CustomAction.exe can also be found. It does the same process when I reference the other two COM objects; wshom.ocx and FirewallAPI.dll. But my actual setup program which is written using Wix copies this CustomAction.exe to some other directory and the .msi uses that particular CustomAction.exe file. The problem occurs since Interop.IISOle.dll (and the others as well) cannot be found there. (The error message said what I needed to look for from the beginning it seems; I was foolish not to look for it but thinking there might be bigger problems)

So this is what I did. I instructed the Wix project to copy those Interop DLL files to the same place where the CustomAction.exe which is used by the installer resides. That solved the problem so easily.

I'm totally a newbie when it comes to Wix, plus we needs to use the CustomAction for 2 and 3 because of some reasons.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文