在项目中使用同一 DLL 的不同版本

Using different versions of the same DLL in a project

在我的项目中,我必须使用不同版本的 AWSSDK dll,为了做到这一点,我得到了 this post 的帮助。并将我的一个 dll 添加到 bin 文件夹内名为 V-1 的文件夹中。然后像这样进行配置更改

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>        
        <assemblyIdentity name="AWSSDK" publicKeyToken="CD2D24CD2BACE800" culture="neutral" />
            <codeBase version="1.4.8.2" href="V-1\AWSSDK.dll" />
            <codeBase version="2.3.40.0" href="AWSSDK.dll" />
        </dependentAssembly>      
    </assemblyBinding>
</runtime>

但我仍然得到这样的错误

Error 2 Could not load file or assembly 'AWSSDK, Version=1.4.8.2, Culture=neutral, PublicKeyToken=cd2d24cd2bace800' or one of its dependencies. The system cannot find the file specified. E:\Live \Web.config 129

在 web-Config 的这一行

 <add assembly="AWSSDK, Version=1.4.8.2,  Culture=neutral, PublicKeyToken=CD2D24CD2BACE800" />

谁能指出我做错了什么??

  1. 请在visual studio
  2. 中打开解决方案资源管理器
  3. 在项目
  4. 下打开References
  5. Select AWSSdk 参考并转到其属性。
  6. 设置特定版本=True复制本地=False
  7. 确保您的输出目录中不包含此 dll。