码迷,mamicode.com
首页 > 移动开发 > 详细

VS2012 Nuget 安装 AutoMapper时报错的解决方法

时间:2017-06-22 15:13:29      阅读:343      评论:0      收藏:0      [点我收藏+]

标签:支持   方式   csdn   版本   tar   visual   sync   for   word   

VS2012 在.net 4.0下安装AutoMapper时,会报以下错误:

“AutoMapper”已拥有为“Standard.Library”定义的依赖项。

‘AutoMapper‘ already has a dependency defined for ‘Standard.Library‘.

经查应该是Nuget版本(VS2012的2.83版本)较低引起的,不支持Standard.Library框架。

 

解决方法有两个:

方式一
NuGet 2.12支持AutoMapper 5.0.1 NuGet 包使用的.NETStandard框架,所以需要把NuGet升级为NuGet 2.12 或以上。
但NuGet2.12是不支持Visual Studio 2012,所以也需要把Visual Studio升级为2013。

方式二(采用)
降级AutoMapper的版本到兼容当前版本的NuGet,经测试4.1.1完美安装上,并且顺带安装了Microsoft.Bcl,可以使用.Net4.5的await和 async了
PM> Install-Package AutoMapper -Version 4.1.1
Installing ‘AutoMapper 4.1.1‘.
Successfully installed ‘AutoMapper 4.1.1‘.

参考:

http://majing.io/questions/557

VS2012 Nuget 安装 AutoMapper时报错的解决方法

标签:支持   方式   csdn   版本   tar   visual   sync   for   word   

原文地址:http://www.cnblogs.com/yanglang/p/7065049.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!