【问题标题】:Could not load file or assembly "*.dll" , The system cannot find the file specified无法加载文件或程序集“*.dll”,系统找不到指定的文件
【发布时间】:2017-10-26 09:29:48
【问题描述】:

Exception screenshot

我很确定C:/test/AdPlatform.Shared.dll 是存在的。 当我在Rider/VisoStudio 中运行它时,它运行良好。 当我尝试将它作为系统服务运行时,它不起作用。没有错误,它会创建空实例。

【问题讨论】:

  • AdPlatform.Shared.dll 来自第三方。

标签: c# csharpcodeprovider


【解决方案1】:

在任何项目中添加程序集/DLL 的自定义引用仅适用于本地机器,不适用于其他机器/环境

在任何项目中从本地路径添加第三方 DLL 总是有风险的

正确方法:

  1. Registering the Custom DLL in GAC 然后添加来自系统路径的引用
  2. 对于 Web 服务/MVC 相关项目creating custom folders(lib) in the Solution itself and adding the DLL from that folder 将是实现它的最佳方式。

【讨论】:

    【解决方案2】:

    如果您想在解决方案中使用外部库,则需要将其文件放在解决方案可以从任何地方访问的位置(也称为部署位置),也就是说,将文件放在解决方案文件夹中并将其 using 语句设置为它的 namespace 在您的项目中引用它的任何地方,所以它一定会找到您需要的库。

    【讨论】:

      猜你喜欢
      • 2015-01-22
      • 1970-01-01
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 2017-06-11
      • 2020-07-08
      • 2010-12-01
      相关资源
      最近更新 更多