Visual Studio:要发布的 DLL 位置
我正在开发一个项目,该项目引用了“公共库(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要做的是将私有探测路径添加到应用程序配置文件中。这告诉 CLR 在哪些目录中查找额外的程序集。
示例 app.config
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