.net - NuGet auto package restore does not work with MSBuild -


i'm trying build solution packages content missing (except repositories.config inside) msbuild 12.0. expect auto restore missing packages before building not case - msbuild reports tons of errors:

"are missing using directive or assembly reference?"

nuget manager 2.7 (i see in visual studio 2013 box). tried pass enablenugetpackagerestore=true parameter - no luck. missing?

updated latest official nuget documentation of v3.3.0

package restore approaches

nuget offers 3 approaches using package restore.


automatic package restore nuget team's recommended approach package restore within visual studio, , introduced in nuget 2.7. beginning nuget 2.7, nuget visual studio extension integrates visual studio's build events , restores missing packages when build begins. feature enabled default, developers can opt out if desired.


here's how works:

  1. on project or solution build, visual studio raises event build beginning within solution.
  2. nuget responds event , checks packages.config files included in solution.
  3. for each packages.config file found, packages enumerated , checked exists in solution's packages folder.
  4. any missing packages downloaded user's configured (and enabled) package sources, respecting order of package sources.
  5. as packages downloaded, unzipped solution's packages folder.

if have nuget 2.7+ installed; it's important pick 1 method > managing automatic package restore in visual studio.

two methods available:

  1. (nuget 2.7+): visual studio -> tools -> package manager -> package manager settings -> enable automatic package restore
  2. (nuget 2.6 , below) right clicking on solution , clicking "enable package restore solution".


command-line package restore required when building solution command-line; introduced in versions of nuget, improved in nuget 2.7.

nuget.exe restore contoso.sln 

the msbuild-integrated package restore approach original package restore implementation , though continues work in many scenarios, not cover full set of scenarios addressed other 2 approaches.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -