1 min read

NuGet packages restore problem

Visual Studio Online build error due to Nuget failing to install missing packages could be due packages folder not being empty.
NuGet packages restore problem
Photo by CHUTTERSNAP / Unsplash

Recently I was doing some work to move a Visual Studio solution from on-premise TFS to Visual Studio Online. I created a new project and checked in all the project files to a new Visual Studio online repository.

Next I got on to configuring the build definitions. There was nothing out of the ordinary in there. What it had was

  • Get Sources
  • NuGet Installer to restore packages
  • Few PowerShell script to set some details to the build
  • VS Build
buildsteps

But my build would fail complaining that DLLs added through NuGet to my project were missing. I checked packages.config files, but they all seemed fine.

Logs from the build also showed no error!
2017-11-24T03:24:51.6908992Z All packages listed in packages.config are already installed.

After a while of looking around I was able to get to what was wrong.
When checking in the copied over solution, although I made sure I did not check in any file(dlls) in the "packages" folder, I had checked in the folders itself! This of course made NuGet think the packages are all in place.

packages

Solution

  1. Remove/Delete all folders & files from "packages" folder except the repositories.config if you have checked those in.