(这可能是一个显而易见的问题,但我不确定该问 Bing/Google 什么)
在 VS2008 (C# Winforms) 项目中,有许多第三方库被引用。该项目使用“Copy Local = True”,以便各种 DLL 文件最终与编译的应用程序位于同一文件夹中。
为了清理一切,我想修改程序,使库都在一个子文件夹下。
例如:
C:\MyProgram\-> 主程序文件夹 C:\MyProgram\Libraries -> DLL存放文件夹
我该怎么做?
最佳答案
执行此操作的最佳方法是将 app.config 文件添加到您的解决方案并为每个子文件夹设置私有(private)探测路径。 CLR 将在搜索程序集时查找这些文件夹
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="subFolder1;subFolder2;" />
</assemblyBinding>
</runtime>
</configuration>
文档
关于c# - 使用与主程序存储在不同文件夹中的引用库 (dll)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3577320/