Winform 设置
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <probing privatePath="bin"/>
  </assemblyBinding>
  </runtime>
</configuration>  为什么运行 .exe读取bin目录里dll还是提示无法加载XXX.DLL.搞了一天了.还是没查到问题

解决方案 »

  1.   

    把你的DLL 删除重新引用一下 编译。。
      

  2.   

    还没调试直接就弹出.无法加载XX.dll
      

  3.   

    在应用程序运行的时候,会检查当前程序运行的目录有无所需要的dll文件,如果找不到,就会查找APP.Config配置文件中所配置的目录
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="bin;bin\B"/>
      </assemblyBinding>
      </runtime>
    </configuration>  
      

  4.   


    不用配置文件也可以AppDomain.CurrentDomain.AppendPrivatePath;
    AppDomain.CurrentDomain.SetupInformation.PrivateBinPath
      

  5.   

    AppDomain.CurrentDomain.AppendPrivatePath(Application.StartupPath + "\\bin\\");