“System.IO.FileNotFoundException:无法加载文件或程序集”当程序集确实存在时

发布于 2024-08-08 02:09:28 字数 684 浏览 3 评论 0原文

作为从 .net 1.1 迁移到 .net 3.5 的一部分,我们必须更改一些供应商 DLL。

其中之一是,在我们使用它的 4 个位置中,只有 1 个位置给我们带来了麻烦:

麻烦位置是一个 Windows 窗体项目,它使用反射来动态加载一些运行长时间运行进程的 DLL。这些长时间运行的进程之一是依赖于我们的供应商 DLL 之一的代理。

在我们第一次输入引用该库的函数时,我们遇到了缺少程序集异常。我已经检查过一些愚蠢的事情,例如我们是否忘记将引用从旧版本移动到新版本,但事实并非如此。我还检查了项目的 bin 目录,程序集就在那里。

有没有人遇到过 .net 2.0 运行时拒绝加载这样的程序集的情况?如果是这样,我们该如何解决这个问题。

附加信息:

本例中的特定供应商是 dtSearch,这是引发错误的边界:

Private Sub BuildIndex()
    SetIndexOptions()
    ExecuteIndexJob()
End Sub

Private Sub SetIndexOptions()
    'Body removed for brevity
End Sub

在 SetIndexOptions 中引用该库。输入 BuildIndex() ,但调用 SetIndexOptions 时发生异常。该函数从未被实际输入。

As part of our migration from .net 1.1 to .net 3.5, we had to change out a few vender DLLs.

One of them is giving us trouble in only 1 spot out of the 4 spots we use it at:

The trouble spot is a windows form project that uses reflection to dynamically load some DLLs that run long running processes. One of these long running processes is an agent that relies on one of our vender DLLs

We're getting the missing assembly exception at the point where we first enter a function that references the library. I already checked the silly things such as if we had forgotten to move a reference from the old version to the new version, but that's not the case. I also checked the bin directory of the project and the assembly is there.

Has anyone encountered a situation in which .net 2.0 runtime refuses to load an assembly like that? And if so, how could we fix the issue.

Additional Information:

The specific vendor in this case is dtSearch and this is the boundry where the error gets thrown:

Private Sub BuildIndex()
    SetIndexOptions()
    ExecuteIndexJob()
End Sub

Private Sub SetIndexOptions()
    'Body removed for brevity
End Sub

The library is referenced in SetIndexOptions. BuildIndex() gets entered, but the exception happens when SetIndexOptions gets called. The function is never actually entered.

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

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

发布评论

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

评论(3

愿得七秒忆 2024-08-15 02:09:28

如果您仍然遇到问题,可以使用 程序集绑定日志查看器 (Fuslogvw.exe ) 来识别您的应用程序加载了哪些程序集。该工具是.NET Framework 的一部分。这将为您提供所有相关程序集的详细信息。

我过去在使用第三方程序集时使用过这个,非常有用

If you are still having problems you can use the Assembly Binding Log Viewer (Fuslogvw.exe) to identify which assemblies are loaded by your application. This tool is part of the .NET Framework. This will provide you with details on all dependent assemblies.

I have used this in the past when working with third party assemblies, very usefull

剪不断理还乱 2024-08-15 02:09:28

如果无法加载依赖程序集之一,即使程序集确实存在,也会引发 FileNotFoundException。

尝试使用 Dependency Walker 来检查并查看所有依赖程序集是否也存在。

The FileNotFoundException can be raised even when the assembly does exist if one of the dependent assemblies couldn't be loaded.

Try using Dependency Walker to check and see that all dependent assemblies are also present.

不交电费瞎发啥光 2024-08-15 02:09:28

结果默认编译选项从 VS2003 更改为 VS2008,并且它以错误的位数进行编译:\ 现在我觉得有点傻!

Turns out the default compile option changed from VS2003 to VS2008 and it was compiling in the wrong bitness :\ Now I feel a bit silly!

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