Jeroen1984
Jeroen1984

Reputation: 1686

Nuget Automatic Package Restore not working on project (.csproj) build (without solution)

We have a solution which contains several projects. Some projects have NuGet packages installed, for example Json.NET. The whole solution is checked in to TFS Version Control, without the packages folder. We have set up Automatic Package Restore according to the "Nuget 2.7+ method" as described in the Nuget documentation (actually we didn't set up that much since all this is enabled by default).

Now here comes the problem:

When we create a build on our TFS 2013 Build Server which should build only one of the projects in the solution (so targeting the .csproj file instead of the .sln file) the nuget packages are NOT getting restored!

Can anyone tell me why this is happening, or tell me if this is by design? I really don't want to build the whole solution, since it is a release build for only a single small project, but i do want the packages getting restored automaticly...

Upvotes: 0

Views: 427

Answers (1)

Kiliman
Kiliman

Reputation: 20312

I believe the Automatic Package Restore hooks into the Build Solution event. Since there's no solution, it's not triggering the restore.

To build a single project, you may need to create a new solution that references just that project.

Upvotes: 2

Related Questions