Suppose I want to restore all NuGet dependencies of a project and then build it. So I go
nuget restore foo.csproj
msbuild foo.csproj
Hover, if foo.csproj is dependent on bar.csproj which has its own (different) NuGet dependencies that won't work. The NuGet restore operation will only restore the foo.csproj dependencies.
I suggest a new -Recursive flag to nuget restore which will recursively restore all descendant dependencies, as to allow the scenario outlined above.
You can already restore a solution, or a folder with many csproj files. Is that not sufficient?
Can you help spell out the exact scenario you are hitting?
Suppose you have a folder with 100 csproj files, and a solution referencing those projects. You could restore the entire folder (either by restoring the sln or *.csproj) but that would be wasteful if you just wanted to build foo.csproj.
Just as msbuild knows to build a csproj recursively, building all dependencies first, ideally so should nuget restore, so I could go
nuget restore foo.csproj
msbuild foo.csproj
In that folder and only restore + build foo.csproj and its dependencies (say bar.csproj).
Makes sense, will keep on our backlog
@emgarten I believe you already tackled this one, can you please validate my assessment and update the issue accordingly?
Fixed as part of https://github.com/NuGet/Home/issues/3577
Use nuget.exe restore foo.csproj -recursive
Most helpful comment
Fixed as part of https://github.com/NuGet/Home/issues/3577
Use
nuget.exe restore foo.csproj -recursive