Sam Leach Sam Leach - 2 months ago 12
C# Question

NuGet Package Restore Issue

I need NuGet to automatically restore packages. At the moment, the referenced dlls are missing.

I have enabled

package restore
on my solution.

The
.nuget
folder is checked in.

The
packages.config
file is checked in for each project.

The
packages
folder (on solution level) is check in.

The
packages
folder contains folders for all the packages the solution uses with
nuspec
and
nupkg
files for each package. The
dll
is not checked in.

In
VisualStudio
the packages are installed but the reference to the dll in each project is missing (ass the dll is not checked in).

I have tried to install
NuGetPowerTools
. Same story.

Thanks,

Answer

There is no reason to check-in anything underneath the packages folder. Optionally, you can check in the repositories.config file but technically this is not required.

Do I get it right that you have checked-in the nuspec and nupkg files within the Packages folder? if so, delete them. These will be restored, and their presence might be causing restore failures (I don't think NuGet package restore is checking for the presence of the package contents, and rather checks for the presence of the nupkg/nuspec file in the Packages folder, skipping the package from being restored if found)

In summary, check in only:

  1. The empty solution level packages folder (optionally the repositories.config)
  2. .nuget folder and its contents
  3. packages.config for every project
Comments