Search code examples
msbuildvisual-studio-2019

How to restore specific project with msbuild


As I know in msbuild 16.5+ we can restore all missing packages (packages.config and reference) with msbuild -t:restore -p:RestorePackagesConfig=true

my question is how to restore missing packages for specific project or solution folder with msbuild command like in Visual Studio with right click on project and click Nuget package manager and click restore button?

I use visual studio 2019 16.8.3


Solution

  • You have to specify the project on the command line like this:

    msbuild xxx\xxx.csproj -t:restore,build -p:RestorePackagesConfig=true