【问题标题】:Cannot configure Application to load external dll's from another folder无法配置应用程序以从另一个文件夹加载外部 dll
【发布时间】:2012-11-02 13:59:59
【问题描述】:

我正在尝试将我的外部 .dll(如 DevExpress 和其他)移动到另一个名为“lib”的文件夹。

我在 app.config 文件中添加了以下几行:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <probing privatePath="lib" />
</assemblyBinding>

我将我的 .dll 文件与我的安装项目一起输出到 lib 文件夹。应用程序安装成功,但是当我启动应用程序时,我的启动屏幕(由 VS2010 配置)显示并消失,这就是发生的一切。目录结构是这样的:

// FAILS
..\MyApp\Application.exe
..\MyApp\Application.exe.config // With assemblyBinding added
..\MyApp\lib\*.dll // All dll files are here

如果我将 application.exe.config 文件更改为从基本目录加载并将 .dll 复制回基本目录,它运行正常。

// RUNS FINE
..\MyApp\Application.exe
..\MyApp\Application.exe.config // With assemblyBinding removed
..\MyApp\*.dll // All dll files are here

可能是什么问题?

谢谢。

【问题讨论】:

  • 首先使用调试器。如果您的代码正在吞噬异常,则使用 Debug + Exceptions, Throw 复选框强制它在引发异常时停止。 Fuslogvw.exe 是解决程序集解析问题的好工具。
  • 我无法重现该问题。您描述的两种情况都对我有用。需要更多关于正在发生什么错误的信息。
  • 谢谢,调试后发现是app.config文件出错。现在可以使用了!

标签: .net visual-studio-2010 dll deployment installation


【解决方案1】:

这是由于配置文件中的错误。修复错误后,它开始工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-22
    • 2017-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-07
    • 2022-11-21
    相关资源
    最近更新 更多