NuGet Package Manager: 'AutoMapper' alread

2019-01-06 15:55发布

I'm trying to add AutoMapper as a dependency to a project using NuGet on Visual Studio Premium 2012, but it fails.

It says:

Operation failed
'AutoMapper' already has a dependency defined for 'Microsoft.CSharp'.

I'm able to add other dependencies.

I'm using the last version of the package manager for VS 2012:

NuGet Package Manager 2.8.60318.667

Any ideas what should I check?

10条回答
再贱就再见
2楼-- · 2019-01-06 16:41

I ended up needing to update NuGet.exe that was included in the solution to be able to build NuGet packages by running:

nuget.exe update -self

查看更多
混吃等死
3楼-- · 2019-01-06 16:43

I had the same issue on VS2013. I had to update to VS2013 Update 5 and get the latest nuget distro for VS2013 at https://dist.nuget.org/visualstudio-2013-vsix/v2.12.0/NuGet.Tools.vsix

once that was done i was able to use the Automapper 5.0.2 package

查看更多
趁早两清
4楼-- · 2019-01-06 16:43

An other workaround if you're stuck with VS2012 and the old Nuget version:

  • Find the Cache folder of VS 2012's Nuget Package Manager (with Tools - Options - Nuget Package Manager)
  • Open AutoMapper.5.x.x.nupkg with your favorite Zip Tool
  • Modify the file AutoMapper.nuspec - I simply deleted all dependencies except .NETFramework4.5
  • Add the cache folder as a Nuget source (also in Tools - Options - Nuget Package Manager)
  • Install Automapper either with the console or the GUI but make sure to choose first the newly added cache folder as package source.

Of course, the next version of Automapper probably needs to be adapted, too, in order to install it.

查看更多
Root(大扎)
5楼-- · 2019-01-06 16:45

Go to Visual Studio > Tools > Extension and Updates

Find Updates in left accordion menu, Go to Visual Studio Gallery.

You will find a update for Nuget.

Update the nuget package and try installing or builing the project.

Thanks, GT

查看更多
登录 后发表回答