KB里有一篇文章专门讲怎样指定路径(KB837908).但讲的只有绝对路径没有讲相对路径.在VS.NET 2005下是这样一来设置的:
第一种情况(Probing):
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;bin2\subbin;bin3"/>
</assemblyBinding>
Probing 只能指定在Application当前的安装路径下的一个子目录,不能在当前路径上的一个相对路径. 如果你发现可以指定上一层的相对路径,你可以告诉我.
第二种情况(Codebase):
Application 安装路径:
C:\Program Files\Library\My.DLL
C:\Program Files\Application\My.Exe
绝对路径:
<dependentAssembly>
<assemblyIdentity name="MY.dll" publicKeyToken="ab0c0e6dbabfedf1" culture="neutral" />;
<codeBase version="1.0.0.0" href="File://C:/Program Files/Library/My.DLL" />
</dependentAssembly>
注意是:href="File://C:/ProgramFiles/Library/My.DLL"
相对路径:
<dependentAssembly>
<assemblyIdentity name="MY.dll" publicKeyToken="ab0c0e6dbabfedf1" culture="neutral" />;
<codeBase version="1.0.0.0" href="..\My.DLL" />
</dependentAssembly>
注意是:href="..\My.DLL"
第一种情况(Probing):
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;bin2\subbin;bin3"/>
</assemblyBinding>
第二种情况(Codebase):
Application 安装路径:
C:\Program Files\Library\My.DLL
C:\Program Files\Application\My.Exe
绝对路径:
<dependentAssembly>
<assemblyIdentity name="MY.dll" publicKeyToken="ab0c0e6dbabfedf1" culture="neutral" />;
<codeBase version="1.0.0.0" href="File://C:/Program Files/Library/My.DLL" />
</dependentAssembly> 
相对路径:
<dependentAssembly>
<assemblyIdentity name="MY.dll" publicKeyToken="ab0c0e6dbabfedf1" culture="neutral" />;
<codeBase version="1.0.0.0" href="..\My.DLL" />
</dependentAssembly> 
浙公网安备 33010602011771号