Reputation: 5162
There are some nuget packages (e.g. OpenCover
or ReportGenerator
) installed without changing packages.config in any of the project, but there is a [Solution Dir]\.nuget\packages.config
created with the package reference information.
When VS builds the solution, the packages defined in that file are not downloaded at all (even I have auto restore nuget enabled).
How can I restore them automatically?
Upvotes: 2
Views: 734
Reputation: 47937
The MSBuild based package restore, that uses NuGet.targets, which is enabled in Visual Studio by selecting Enable NuGet Package Restore, does not seem to support restoring solution level packages, which are those that are defined in the [SolutionDir]\.nuget\packages.config file.
Looking at the NuGet.targets file on build it restores the packages for the project using the project's packages.config file but does not use the solution's packages.config file.
So your options are:
The MSBuild based package restore has been deprecated by the NuGet team so I would use option 1) if this is possible.
Upvotes: 2