Reputation: 131
I have a mvc 5 web project with a number of NuGet packages installed (like email, log, pagedlist etc).
In a new similar project I would like to install the same NuGet packages. How can I in the old project list all installed NuGet packages?
Upvotes: 3
Views: 390
Reputation: 20312
Most of the answers here are partially correct.
The first part is true. The packages.config file lists all packages that are used by the project.
However, all the answers about using Package Restore are incorrect. Package Restore will download any missing packages, however it is NOT the same as installing a package into a project. It will not add references, run any install.ps1 scripts, or add files, modify .config, etc. Package Restore simply downloads missing packages. It is assumed that the packages were already installed to the project.
In order for the packages to be correctly installed in your new project, open the Package Manager console, then type:
Update-Package -ProjectName MyProjectName -Reinstall
This will force NuGet to run through the install process and correctly install the package into your project.
Upvotes: 0
Reputation: 3223
packages.config
file in the old project's root directory. Allow NuGet to download missing packages
and the other check box that states Automatically check for missing packages during build in Visual Studio
it will download it for you next time you build.Upvotes: 3
Reputation:
If you want to list all installed nuget packages for the project take a look at this one.
You might also want to enable nuget package restore to restore the packages when rebuilding your project/s. Here's another link for you - http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
Upvotes: 2
Reputation: 1289
packages.config
file. Copy its contents to your new project, same file name.Now build your new project
Upvotes: 1