Visual Studio 2015 loses Nuget packages on new installations

三世轮回 提交于 2019-12-11 12:36:34

问题


I have a solution with various projects in it. The packages folder is in the solution root. Every time my solution is downloaded onto another PC from TFS, Visual Studio runs the package restore automatically, but then complains that the references to the packages are missing. All of them are where they should be in the packages folder.

Is this a bug with Visual Studio 2015, or am I doing something wrong?

EDIT:

The package dll's are missing from the packages folder. Only the nuspec files are there. It is as if it didn't even run the restore.


回答1:


Don't include the packages folder in TFS, just make sure that your packages.config's are included and should be 1 for each VS project. The repositories.config ideally should not be checked into source control (but it can be sometimes, see the link) as this is generated locally on build by VS.

I guess that what you have done is tried to check in the packages and TFS has automatically ignored the .dlls but included the .nupkg files and it therefore when downloaded to another machine, NuGet tells VS that it has the dlls but actually it doesn't

Have a read of this https://docs.nuget.org/consume/package-restore and there are a couple of choices depending on your TFS version and NuGet version, but in my case I have decided not to include the packages folder nor the repositories.config and to create the .nuget folder at solution level containing the NuGet.config file and then the .tfignore file also at solution level.

This now means that everytime I update or add a package, only the .csproj and package.config files are included in my Pending Changes



来源:https://stackoverflow.com/questions/34024257/visual-studio-2015-loses-nuget-packages-on-new-installations

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