Nuget package restore -


i trying work out how nuget knows packages needs restore (and how knows find them) in case not present locally (i.e. when packages have not been committed source control).

i can see in solution have .nuget directory contains nuget.exe. there's packages.config in each project, looks promising, contains following (shortened clarity);

<?xml version="1.0" encoding="utf-8"?> <packages>  <package id="automapper" version="2.2.1" targetframework="net40" /> </packages> 

i expecting see url pointing source of package. if nuget uses package id string, how know if had multiple package sources both list available same package id. through priority in package sources?

i ask because have package local source, deleted packages , disabled package source, cleaned solution , rebuilt. worked when expected fail.

many thanks.

there 2 questions in post, i'll try address 1 one:

how nuget knows packages needs restore?

as guessed, nuget uses .nuget folder automatically install missing packages. inside .nuget folder, there file named "nuget.targets" vs project file (.csproj) containing line

<restorecommand>$(nugetcommand) install "$(packagesconfig)" -source "$(packagesources)" -nocache  $(requireconsentswitch) -solutiondir "$(solutiondir) "</restorecommand> 

which takes charge install packages listed in packages.config file in each projects.

so if nuget uses package id string, how know if had multiple package sources both list available same package id ?

in %appdata%\nuget.config, can see list of "package sources" nuget: given packageid, nuget search in these package sources in same order in nuget.config


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -