walk along at the far from top

沙尘里的世界

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

有的时候由于某种需求,需要我们的Dll在主程序的不同的子目录中,为了能够让程序启动时能够正确加载Dll需要配置一下Runtime配置节。该方法在.net1.1,2.0的Winform程序测试通过。

在你的应用程序项目中加入config文件,如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <probing privatePath="Lib"/>

      <dependentAssembly>
        <assemblyIdentity name="ClassLibrary1" publicKeyToken="null" culture="neutral" />
        <codeBase version="0.0.0.0" href="Lib/ClassLibrary1.dll"/>
      </dependentAssembly>

    </assemblyBinding>
  </runtime>
</configuration>

posted on 2008-12-10 14:30  lexod  阅读(604)  评论(2编辑  收藏  举报