Tomas Chlouba
Tomas Chlouba

Reputation: 151

NuGet package restore not working from .nuget\packages.config

I have a project, which uses Chutzpah to run unit tests, however the project does not use Chutzpah any other way, it only uses its command line interface. When I installed the Chutzpah NuGet package, the reference was added to .nuget\packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="Chutzpah" version="2.4.3" />
</packages>

I have package restore enabled for this project and the build successfully restores all other used packages but not Chutzpah. I assume it has to do with the fact, that the package reference is located in .nuget\packages.config and not in a project packages.config file, but I don't know why this happened and what is the correct way to work with this?

The Chutzpah NuGet package was added to the project via Visual Studio to a specific project.

To work around the issue I moved the package reference to a project packages.config file and the restore works fine.

Upvotes: 7

Views: 1523

Answers (1)

Shamozzle
Shamozzle

Reputation: 101

Package Restore will not automatically restore solution-level packages. You will need to add a build step to get NuGet to restore the solution packages. For example:

.nuget/nuget.exe install .nuget/packages.config -o packages

For more information see this post on solution level packages.

Upvotes: 1

Related Questions