Visual Studio 2013 NuGet package restore does not work from command line (not msbuild but vcvarsall.bat)

1.6k views Asked by At

Visual Studio 2013 introduced new way of package restore without MSBuild and the old way of Enable NuGet Package Restore is deprecated now.

After migrating a project, as written in Nuget docs, when building in VisualStudio package restore works, but when build is run using command line VisulStudio and event vcvarsall.bat packages are not restored.

Am I missing something?


Conclusion

Well, if you invoke Visual Studio from command line, package restore is not called. Use manual package restore with nuget.exe

nuget restore Solution.sln

For this particular line to work you'll need to install NuGet system wide and add path to it's binaries folder into PATH environment variable

1

There are 1 answers

3
jessehouwing On BEST ANSWER

On the commandline you must manually run Nuget restore solution.sln before invoking msbuild.exe. It's just a small step before the build runs.

Visual Studio does this automatically and the call to nuget restore is also executed by Team Build as part of the workflow.