“Restore NuGet Packages” in Visual Studios 2015 not doing anything

和自甴很熟 提交于 2019-12-21 17:25:17

问题


I pulled my solution from SVN into Visual Studios 2015. I'm getting errors on some of my "using" references within the code, so I am trying to run the "Restore NuGet Packages" option when right clicking the solution in the "Solution Explorer". This does nothing. I have to manually go into nuget manager and uninstall then reinstall the items. Why is this? How can I get "Restore NuGet Packages" to work?


回答1:


You might did not enabled automatic package restore from the following section:

Tools >> Options >> Nuget Package Manager >> General settings.

Also you can try this:

Update-Package -Reinstall

This code will forces re-installation in all solution's projects.

Look at the following for more info:

nuget-package-restore-not-working

Migrating MSBuild-Integrated solutions to use Automatic Package Restore

Hope this will help :)




回答2:


This is what works for me:

  1. Download the project from TFS (or in your case SVN).
  2. Delete the "packages" folder
  3. Make sure the "Package Manager Console" is enabled (Tools -> NuGet Package Manager -> Package Manager Console)
  4. Open the solution file.
  5. At the right side of the "Package Manager Console," a "Restore" button should appear. Click on the "Restore" button.

After following those steps, I no longer get those errors with the "using" references after building.

Hope that helps you.

Edit: If after you complete the above steps you are still getting syntax errors from missing references, right-click on References in the Solution Explorer and then just hit OK. That fixed the problem with the references for me.



来源:https://stackoverflow.com/questions/38230948/restore-nuget-packages-in-visual-studios-2015-not-doing-anything

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