David
David

Reputation: 16120

nuget - package restore not working

My aim is to have package restore working on a build server so that I don't have to check in binaries. At the moment, I'm simply trying to get it to work on my own machine using Visual Studio.

Here's what I've done so far:

  1. Followed the instructions here http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages, including both setting the Tools-Options flag and the environment variable (belt and braces)
  2. Installed the NuGetEnablePackageRestore package as suggested here NuGet package restore consent without NuGet
  3. Checked everything in (the .nuget solution folder and its contents), but not the binaries I want to reference, because that's the whole point of the exercise

Here's what I'm doing:

  1. Check out solution
  2. Verify that nunit.framework.dll and moq.dll are not present in the checked out solution
  3. Build the solution

Visual Studio complains that Moq is missing. I search for the dlls in the solution directory and find that:

  1. nunit.framework.dll is present in the appropriate bin folders
  2. Moq.dll is nowhere to be found

But there's more. This is truly mysterious, but if I do a fresh checkout, disconnect from the internet and build, I get precisely the same results - nunit.framework.dll is there, but moq.dll is not. The build process has conjured nunit.framework.dll literally from nowhere.

So it's something of an understatement to say that I am completely baffled. Can anyone suggest answers to the following questions:

  1. Why is package restore not downloading Moq?
  2. Where on earth is the build process getting nunit.framework.dll, if not the internet?

Upvotes: 2

Views: 2856

Answers (2)

diegohb
diegohb

Reputation: 1887

In vs, Options, Package Manager... there's a section "Package Cache", if you click on the "Browse" button it will take you to the location of the nuget cache in your machine.

Upvotes: 2

David
David

Reputation: 16120

Okay, I noticed in the documentation that enabling package restore was supposed to modify project files in order to add a new target. My project files did not have this change. Right-clicking the solution title in VS and selecting 'Manage NuGet packages...' then added the required changes and everything built as it should.

I checked, and package restore still appears to work when I have no internet access, so I'm still mystified about that. Does NuGet maintain some kind of cache of binaries outside the solution?

Upvotes: 1

Related Questions