【问题标题】:C# application cannot find .dll reference file while both are in the same folderC# 应用程序在同一个文件夹中时找不到 .dll 参考文件
【发布时间】:2014-02-20 20:53:22
【问题描述】:

我在我的 winform c# 项目中添加了一个 .dll 文件作为参考。

输出是一个 .exe 文件和一个 .dll 文件。

当我运行 bin/debug 文件夹中的 .exe 文件时,它运行良好。.. 或我自己计算机上的任何其他文件夹。

为了在其他计算机上运行 .exe 文件,我只需将 .exe 文件和 .dll 文件复制到一个文件夹中..

我对它在某些计算机上工作感到困惑,但在其他计算机上却弹出​​停止工作错误:

Problem signature:
   Problem Event Name:                        CLR20r3
   Problem Signature 01:                       programname.exe
   Problem Signature 02:                       0.0.0.0
   Problem Signature 03:                       4e20a786
   Problem Signature 04:                       mscorlib
   Problem Signature 05:                       2.0.0.0
   Problem Signature 06:                       4d8c1599
   Problem Signature 07:                       f9b
   Problem Signature 08:                       80
   Problem Signature 09:                       System.IO.FileNotFoundException
   OS Version:                                          6.1.7600.2.0.0.16.7
   Locale ID:                                             1033

使用异常控制后,我得到了这个错误详情:

System.IO.FileNotFoundException: Could not load file or assembly 'dllname.dll' or one of its dependencies. The specific modulo could not be found.

有什么问题!两个文件(.exe 和 .dll)都在同一个文件夹中!它适用于某些 PC!

请注意,所有计算机上都安装了所需的 .Net Framework。

请注意,有一次我安装了 MS Visual Studio 2012,然后错误消息消失了,之后程序正常运行了!!我不知道安装 VS 2012 和问题之间可能有什么关系!

请注意,该程序在未安装 VS 的 PC 上也能正常运行!

提前感谢任何帮助。

【问题讨论】:

  • 计算机是 64 位的吗?那些它不工作的呢?您针对 x86、x64、任何 cpu 构建了什么架构?
  • 所有 PC 上是否安装了相同版本的 .Net?
  • Visual Studio 安装了一些系统范围的软件包。您的 dll 可能依赖于其中之一。尝试using the fusion log 来确定究竟是什么绑定失败了。
  • 请注意错误消息“或其依赖项之一”。听起来 dllname.dll 依赖于其他一些恰好存在于您的 PC 上但不存在于其他库的库。
  • 如果是安装 VS2012 以使其工作,这可能意味着您所针对的 .NET 运行时未安装在远程计算机上,或者,您的某些依赖项需要 c++运行时也要安装。 VS2012 会在其安装过程中安装它

标签: c# reference filenotfoundexception


【解决方案1】:

感谢大家的cmets,

我使用了 Dependency Walker 并在系统中找到了丢失的 dll。

所以安装 VC++ Redistributable 2010 和其他东西解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-25
    • 1970-01-01
    相关资源
    最近更新 更多