SGoldwin
SGoldwin

Reputation: 131

VisualStudio 2013 list all NuGet packages

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

Answers (4)

Kiliman
Kiliman

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

gyosifov
gyosifov

Reputation: 3223

  1. You can find a packages.config file in the old project's root directory.
  2. You can copy it to the new project.
  3. If you go to Tools -> NuGet Packet Manager -> Packet manager settings and check 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

user3305961
user3305961

Reputation:

If you want to list all installed nuget packages for the project take a look at this one.

http://blogs.msdn.com/b/david_kidder/archive/2014/08/19/micro-blog-how-to-list-installed-nuget-packages-from-package-manager-console-and-be-able-to-read-them.aspx

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

fozylet
fozylet

Reputation: 1289

  1. In the root folder of your original project find a packages.config file. Copy its contents to your new project, same file name.
  2. Go to Visual Studio > Tools > Package Manager Settings > General
  3. Enable "Allow Nuget to download..." and "Automatically check for missing..."

Now build your new project

Upvotes: 1

Related Questions