解决方案 »

  1.   

     默认就是安装目录下的 DLL 其次才是 System下的
    你要指定就在 [DllImport("D:\\XXX\XXX***.dll")] 
      

  2.   


    因为我也不知道安装时会到哪个目录啊,所以“D:\\XXX\XXX”写了也是没有意义的你的意思就是直接写 [DllImport("***.dll")] ,不用做任何更改了?
      

  3.   

      不用呀,C#模认就是先找同一目录下的。找不到再找System下的 然后再找 Windows下的
      

  4.   

    不用管客户安装到哪个目录了。。打包时把那些Dll都打到exe同名目录下,安装后不一样能运行嘛。
      

  5.   

    你调用的时候不是要写路径的嘛,用相对路径就行了,打包的时候dll是 和exe在一起的
      

  6.   

    当前路径中也可以,对于EXE来讲,就是Exe所在的问题。Web的话有点麻烦,当前路径是windows下的什么。 [DllImport("***.dll")] 直接文件名,不用谢路径。
      

  7.   

    就是Exe所在的路径
      

  8.   

    lz从哪里听来的dll必须要放在system32下的?
      

  9.   

    1.Path环境变量中的目录
    2.system32
    3.应用程序当前目录
    4.assemblyBinding配置节指定,单个程序集可用dependAssembly
    <runtime>    
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="ICSharpCode.SharpZipLib" culture="neutral" publicKeyToken="1b03e6acf1164f73" />
            <codeBase version="0.86.0.518" href="子目录相对路径\ICSharpCode.SharpZipLib.dll" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    多个dll,可以放到一个子目录中,然后用probing:privatepath指定搜索路径
    <configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <probing privatePath="bin;bin2\subbin;bin3"/>
          </assemblyBinding>
       </runtime>
    </configuration>
    http://msdn.microsoft.com/zh-cn/library/823z9h8w(v=vs.80).aspx