.net - 为什么 AutoMapper v3 不能工作,因为它正在寻找 v2.2.1.0?

标签 .net nuget automapper automapper-3

我刚刚通过 nuGet 在一个新项目上安装了 AutoMapper,但是当我运行代码时,出现以下错误:

Could not load file or assembly 'AutoMapper, Version=2.2.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)



为什么它在寻找 Version=2.2.1.0,我该怎么办?恢复到那个版本?

最佳答案

您可能只想为 AutoMapper 添加绑定(bind)重定向,因为您的引用之一正在寻找 2.2 版

这应该这样做:

 <dependentAssembly>
      <assemblyIdentity name="AutoMapper" publicKeyToken="be96cd2c38ef1005" 
                     culture="neutral"/>
      <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
    </dependentAssembly>

关于.net - 为什么 AutoMapper v3 不能工作,因为它正在寻找 v2.2.1.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18552159/

相关文章:

powershell - MSBUILD是否可以在不重新启动Visual Studio的情况下接收新的 'user'级别的环境变量?

c# - Automapper 无法转换为类型

.net - HttpWebRequest 的 Timeout 和 ReadWriteTimeout——这些对底层 TCP 连接意味着什么?

c# - 如何将解决方案测试的代码覆盖率结果文件输出到解决方案目录而不是测试项目目录

.net - 如何在依赖于可移植类库的库上成功运行 secannotate.exe?

.net - 在有区别的联合中F#中使用and关键字

msbuild - 有没有一种简单的方法可以从 Visual Studio 2015 项目自动创建 NuGet 包?

iis - 无法从自托管的 nuget 服务器下载包(404 错误)

c# - 自动映射器将列表复制到列表

在 Visual Studio Team Services 中的托管生成代理上进行 Nuget 还原时,找不到 AutoMapper 包 5.1.1