假设项目:
生成:Demo.exe
引用:1.dll;2.dll;3.dll如果程序及所有dll都在同一目录时,程序可以正常运行。实际打包时,我想把所有dll部署到 .\libs 目录下。请教怎么才能实现既可自定义部署,又保证程序正常运行?

解决方案 »

  1.   


    试过了,这样好像不行啊(1.dll;2.dll;3.dll是被Demo.exe引用的组件),重新生成后:
    Demo.exe
    .\libs\1.dll
    .\libs\2.dll
    .\libs\3.dll....运行Demo.exe 报错
      

  2.   

    配置文件中射定:<?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <probing privatePath="bin;lib;Components"/>
        </assemblyBinding>
      </runtime>
      

  3.   

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <runtime>
            <gcConcurrent enabled="true"/>
            <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
                <publisherPolicy apply="yes"/>
                <probing privatePath="libs"/>
                <!--文件夹名-->
            </assemblyBinding>
        </runtime>
    </configuration>
      

  4.   

    看这里怎么样~~
    引用不同文件夹下的Dll文件
    http://blog.csdn.net/whowhen21/archive/2009/04/23/4104281.aspx
      

  5.   

    我也遇到这个问题,在exe同目录下带上相应的.config确实没问题;
    但我想知道有没有办法将配置写进exe中,即不在外部带.config文件
      

  6.   

    添加需要的DLL到项目里面,对DLL右键属性,选择始终或较新复制
      

  7.   


    不想用反射的方式,而且,就这种方法在CSDN很多文章都有,就是没有实例,反正我试过不知道怎么在我这也不行。
      

  8.   

    我也有同样的问题,关注ING...