.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:
- on project or solution build, visual studio raises event build beginning within solution.
- nuget responds event , checks packages.config files included in solution.
- for each packages.config file found, packages enumerated , checked exists in solution's packages folder.
- any missing packages downloaded user's configured (and enabled) package sources, respecting order of package sources.
- 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:
- (nuget 2.7+): visual studio -> tools -> package manager -> package manager settings -> enable automatic package restore
- (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
Post a Comment