1

I have various Nuget packages installed to my solution. Some in my domain project and some in my MVC Front End project.

This all works quite happily. However if you get the project new from source control I can see I have all the packages in the packages folder. However they all appear to have an exclamation after them in References for the projects.

If I use nuget command nuget install .\ProjectFolder\Packages.config it seems to install the pacakges again but the refrences still don't appear. I have to manually install them using nuget manage references and install them individually. Which is a bit of a hassle for new developers starting projects.

Seems a bit odd? Is something wrong or is this normal? Shouldn't Nuget/VS2010 know that all packages exist and be happy as the packages are all in the local file system from source control (I know there is a debate about keeping them there but lets leave that aside)

Thanks

Graeme

GraemeMiller
  • 11,973
  • 8
  • 57
  • 111

3 Answers3

4

Updated June 28, 2014

You might consider a reinstall of your packages. See this thread: How do I get NuGet to install/update all the packages in the packages.config?

Leaving the outdated answer below for history, but note that the MSBuild-based package restore is currently considered a bad practice (more info: http://www.xavierdecoster.com/migrate-away-from-msbuild-based-nuget-package-restore)

Outdated answer below:

Not a direct answer to your question, but maybe a valuable suggestion when using NuGet with TFS. You might consider the no-commit strategy for NuGet packages, and use the NuGetPowerTools Enable-PackageRestore command.

More info here:

Community
  • 1
  • 1
Xavier Decoster
  • 14,580
  • 5
  • 35
  • 46
  • +1. Yeah, I was of the opinion longer term I didn't really want binaries in my source control. That is a great selection of links. I will check my own answer I guess as it was more of a technical fault. However I feel this answer is probably the correct way in general to deal with TFS + Nuget Packages – GraemeMiller Oct 29 '11 at 10:45
  • I think this answer is out-of-date and needs to be revised. The first two links point to Nuget.org advice that say "enable package restore"m yet in your own blog you argue against this. Can I suggest this is edited? – Quango Jun 28 '14 at 13:18
  • @Quango thanks, provided an alternative answer as my old answer is really outdated! – Xavier Decoster Jun 28 '14 at 18:39
1

Install NuGetPowerTools package and then Enable-PackageRestore from the Package Manager Console. That should fix it.

This is the short version of @Xavier response :).

Ryan Cromwell
  • 2,613
  • 1
  • 17
  • 33
0

I'm guessing it isn't normal. I removed the entire packages folder. Re-added all packages to my solution and then committed all the changes.

It now it seems to work if I re-get the site from source control. Maybe something was corrupted. The project was originally started before I was using source control and nuget. Maybe some sort of initial setup issue.

Thanks

Graeme

GraemeMiller
  • 11,973
  • 8
  • 57
  • 111