众所周知,.NET程序所参照的DLL按照所有的文件路径划分,可分为两类:
- 全局DLL(注册在GAC中)
- 私有DLL(Win程序和exe文件在同一文件夹下,Web程序在顶层web.config同级的Bin文件夹下)
对于私有的DLL,当其数目众多时,由于没有分类,会显得比较凌乱;如果将其分类,分别放到对应的子目录,则会清爽许多.
问题是,如何解决应用程序对DLL的查找路径问题呢?答案是在配置文件中添加如下配置项:
<?xml version="1.0" ?>
<configuration
xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
<asm:probing privatePath="shared;common" />
</asm:assemblyBinding>
</runtime>
</configuration>
<configuration
xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
<asm:probing privatePath="shared;common" />
</asm:assemblyBinding>
</runtime>
</configuration>