AutoMapper package 5.1.1 is not found when Nuget restore on hosted build agent in Visual Studio Team Services

只愿长相守 提交于 2019-12-10 15:19:14

问题


Really weird problem with restoring AutoMapper on the hosted build agent in Team Services (previously VSO). It just fails with a Warning 'Unable to find version 5.1.1 of package AutoMapper'.

We have a custom and private nuget repo so we've had to add a nuget.config to list all the sources but for some reason AutoMapper cannot be found! It works perfectly fine in Visual Studio IDE even after deleting the packages folder.

To test out if it is the custom setting with nuget sources, I've created a build for another solution which happily goes past the restore as there is no reference to AutoMapper there.

I cannot conclude it is AutoMapper because it works from IDE but I cannot say that the nuget.config is a problem either because the second solution works (has a different issue


回答1:


Sounds like the VSO build agent does not have the latest NuGet client installed. It's this reason that I include nuget.exe in my repository - too many times NuGet client breaks against nuget.org.




回答2:


In VSO, you can select the Nuget version in the advanced section of the Nuget Installer build step. I just set mine to "3.5.0 - build 1938 (rc2)" and nuget was able to find the AutoMapper package.




回答3:


We got around this problem and here's how:

The problem started when we added nuget config part of the build process as we have our own nuget server as well for packages that are internal.

After trying ExpressMapper and working with it for some components, we found that AutoMapper is a dependent package for some of the packages we use so we had to find a way to use automapper.

we built automapper package version we needed and uploaded it to our own nuget server and that worked. I hope this helps someone.




回答4:


There was (or is) a known problem with the nuget v2 feed/api. Which goes away if you use v3. See@ https://github.com/NuGet/Home/issues/1448

It's fixed in later versions of nuget, which might be why upgrading the version fixed it here.



来源:https://stackoverflow.com/questions/39539603/automapper-package-5-1-1-is-not-found-when-nuget-restore-on-hosted-build-agent-i

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!