Visual Studio:要发布的 DLL 位置

发布于 2024-09-16 00:41:58 字数 425 浏览 1 评论 0原文

我正在开发一个项目,该项目引用了“公共库(DLL)”。在 DevEnv 中它工作正常,但是如果我构建并尝试组织我的文件,它就不起作用。基本上,如果我有这样的设置:

  • C:\Program Files\MyApp\MyApp.exe
  • C:\Program Files\MyApp\Common\WPF Commons.dll
  • C:\Program Files\MyApp\Modules\SomeModule.dll

MyApp。 exe 不起作用。它尝试仅在当前目录中查找 DLL 文件。那么如何在 Visual Studio 中进行设置,以便在构建应用程序时知道在其他文件夹中查找 DLL?

哦,我意识到它在 Dev 中确实有效,因为所有 DLL 都放在同一个文件夹中。但我不想在发布时这样做:-/

I have a project that I am working on that references a "Common Library (DLL)". In the DevEnv it works fine, however if I build and try to organize my files it doesn't work. Basically if I have things setup like so:

  • C:\Program Files\MyApp\MyApp.exe
  • C:\Program Files\MyApp\Common\WPF Commons.dll
  • C:\Program Files\MyApp\Modules\SomeModule.dll
  • etc

MyApp.exe doesn't work. It tries to look only in the current directory for the DLL files. So how do I set it up in Visual Studio so that when I build the application knows to look for the DLLs in those other folders?

Oh, and I realize that it does work in Dev because all the DLLs are put in the same folder. I don't want to do that for release though :-/

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

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

发布评论

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

评论(1

动次打次papapa 2024-09-23 00:41:58

您需要做的是将私有探测路径添加到应用程序配置文件中。这告诉 CLR 在哪些目录中查找额外的程序集。

示例 app.config

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="Common;Modules"/>
      </assemblyBinding>
   </runtime>
</configuration>

What you need to do is add a private probing path into the application configuration file. This tells the CLR which directories to look in for extra assemblies.

Sample app.config

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <probing privatePath="Common;Modules"/>
      </assemblyBinding>
   </runtime>
</configuration>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文