10

Is it possible to use nuget to install multiple packages at once? That is, both download all nuget packages listed in packages.config and add the packages to the .csproj file.

What I do now is to use the NuGet Package Manager in Visual Studio and install each package one by one, but is there an easier way?

EDIT: This question is not solved by How do I get NuGet to install/update all the packages in the packages.config? as it only downloads and installes the packages to the packages directory, and does not change the project files.

If I run

nuget install packages.config

It will install all packages in the packages.config file, but not update the project file.

Community
  • 1
  • 1
sighol
  • 2,678
  • 6
  • 28
  • 34
  • 2
    Possible duplicate of [How do I get NuGet to install/update all the packages in the packages.config?](http://stackoverflow.com/questions/6876732/how-do-i-get-nuget-to-install-update-all-the-packages-in-the-packages-config) – Red Dec 14 '15 at 12:02
  • 1
    It sounds like what you want is when you create a brand new project, you just want to copy a packages.config into the folder and execute the *nuget install packages.config* and get it to update the project file as well. Am I on the right track? – Black Frog Dec 14 '15 at 15:10
  • 1
    @BlackFrog Yes, that is correct. After I copied packages.config, I ran `Update-Package -reinstall` as suggested by @Zidad in the answer below. And that worked. – sighol Dec 14 '15 at 17:19

1 Answers1

15

Could you try to run this from the package manager console in Visual Studio:

Update-Package –reinstall

That should fix missing assembly references in your *.csproj files, if the packages are already in your packages.config.

shA.t
  • 16,580
  • 5
  • 54
  • 111
Wiebe Tijsma
  • 10,173
  • 5
  • 52
  • 68
  • 2
    You may also need to use `-projectName` flag to select particular project. Otherwise, packages will be reinstalled in all projects in a solution. – Dariusz Woźniak Nov 13 '19 at 12:20