.net - NuGet automatic package restore poses problems for libraries -


when using nuget automatic package restore added in version 2.7, nuget automatically downloads missing packages packages\ folder located @ solution level. when solution includes libraries (i.e. git subtree or git submodules) causes problems library projects expect packages downloaded packages folder located in respective solution folder (which typically nested subfolder inside primary code's solution folder) , not know packages in primary code's solution folder. example:

primary_code_folder\ ->primary_code.sln ->packages\     [various packages downloaded nuget] ->primary_code_project\ ->library_solution_folder\ --->library_code.sln --->packages\       [where library project expects packages reside] --->library_code_project\ 

potential solutions this:

  1. manually open each library project .sln file , build project ensure latest packages restored within each library package folder. undesirable requires each developer remember every time updates/installs new package.
  2. somehow configure each library in packages folder in primary solution's code. seems highly undesirable fix because modifies library's code unique given project being used in.
  3. configure primary code's solution run nuget.exe restore library_code.sln in pre-build event command line command. however, nuget.exe isn't naturally in solution , isn't (by default) located in path variable. seems copying nuget.exe project may cause later incompatibility updates not pulled in. perhaps there workaround this?
  4. somehow configure nuget store packages on project level instead of solution level?

can share how have approached problem? similar question asked here (nuget automatic package restore when using git submodules) different situation , answer not satisfy needs describing in post.

this can done placing multiple nuget.config files, @ each folder location, sln exists.

within nuget.config need add following

<config>  <add key="repositorypath" value="c:\temp" /> </config> 

or

<config>  <add key="repositorypath" value="..\..\.." /> </config>  

have here more details https://docs.nuget.org/consume/nuget-config-settings


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -