问题描述
我正在尝试将 AutoMapper 作为依赖项添加到在 Visual Studio Premium 2012 上使用 NuGet 的项目,但它失败了.
I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it fails.
上面写着:
操作失败
'AutoMapper' 已经定义了一个依赖项'Microsoft.CSharp'.
Operation failed
'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
我可以添加其他依赖项.
I'm able to add other dependencies.
我正在使用 VS 2012 的最新版本的包管理器:
I'm using the last version of the package manager for VS 2012:
NuGet 包管理器 2.8.60318.667
NuGet Package Manager 2.8.60318.667
我应该检查什么?
推荐答案
好像是automapper当前版本的问题:
Seems to be a problem with the current version of automapper:
AutoMapper 5.0.0 2016 年 6 月 28 日,星期二
AutoMapper 5.0.0 Tuesday, June 28, 2016
我尝试了以前的版本,它可以工作:
I tried with the previous version and it works:
PM> Install-Package AutoMapper -Verbose
Install-Package : 'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.
At line:1 char:16
+ Install-Package <<<< AutoMapper -Verbose
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
PM> Install-Package AutoMapper -Version 4.2.1
Installing 'AutoMapper 4.2.1'.
Successfully installed 'AutoMapper 4.2.1'.
所以,如果不能更新 NuGet 包管理器,答案是:
So, if you can't update NuGet Package Manager, the answer is:
PM> Install-Package AutoMapper -Version 4.2.1
这篇关于NuGet 包管理器:“AutoMapper"已经为“Microsoft.CSharp"定义了依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!