How should I use Nuget for internal enterprise development? -


we use nuget our internal development allow share code across teams. run issues when 1 person working on code deployed across multiple nuget packages @ same time. instance

a depends on b depends on c.

a, b , c have artifacts pushed nuget , that's how manage dependencies between a, b , c. trouble find if developer wants make changes in c , see changes reflected in a, have go through following process.

  1. make change in c.
  2. push change git
  3. ci picks change c , builds , deploys new nuget package.
  4. go b , update reference c using nuget update package command.
  5. push change packages.config file git
  6. ci picks change b , builds , deploys new nuget package b
  7. now open , change reference b , nuget update package
  8. make changes in go along changes in b(and transitively c)

this seems extremely painful , causing of our developers question choice of nuget our internally developed code. still consuming external packages.

is there better workflow using nuget internally?

in our company have solved cascading updates problem following setup. first have following setup our nuget repositories , build server.

  • there internal nuget repository holds published packages company. repository shared directory on 1 of our servers.
  • each developer can have (but doesn't need have) 1 or more directories on own machine serves local nuget package repository. using user specific nuget configuration developer can control in order nuget searches through package repositories find packages.

    <?xml version="1.0" encoding="utf-8"?> <configuration>   <packagerestore>     <add key="enabled" value="true" />   </packagerestore>   <packagesources>     <add key="dev" value="d:\dev\testpackages" />     <add key="company" value="<unc_address_company_repository>" />     <add key="nuget official package source" value="https://nuget.org/api/v2/" />   </packagesources>   <disabledpackagesources />   <activepackagesource>     <add key="all" value="(aggregate source)" />   </activepackagesource> </configuration> 
  • all solutions have automatic package restore turned on, don't have commit packages our version control system.

  • developers control 3 out of 4 version numbers, e.g. if version <major>.<minor>.<build>.<revision> developers can change major, minor , build numbers, revision number set 0 except in builds done build server build number of build. important because means given version consisting of major, minor , build number build server produce higher version number. again means nuget prefer take package version coming company package repository (which gets packages through build server).

in order make change 1 of base libraries there 2 possible processes being used. first process is:

  1. make changes base library (a). update version of (a) if needed.
  2. run msbuild script build binaries , create nuget packages of (a)
  3. copy new nuget packages on package repository on local machine
  4. in dependent project (b) upgrade new packages of (a) placed in local machine package repository (which should of higher version ones available on company wide repository, or nuget.org)
  5. make changes (b).

if more changes required (a) repeat steps 1,2 , 3 , delete package of (a) working directory of (b). next time build runs nuget go looking specific version of (a), find in local machine repository , pull in. note nuget cache may thwart process of time, although looks nuget may not cache packages come same machine(?).

once changes complete, we:

  1. commit changes (a). build server run integration build verify works.
  2. tell build server run release build, builds binaries , pushes nuget packages company-wide nuget repository.
  3. in (b), upgrade latest version of (a) (which should have higher version number test package because test package should have version a.b.c.0 while newly build version in company-wide repository should a.b.c. > 0
  4. commit changes (b). wait build server finish integration tests
  5. tell build server run release build (b).

another way of doing development work taking following steps

  1. make changes base library (a). update version of (a) if required.
  2. build binaries
  3. copy binaries on location nuget unpacks package of (a) project (b) (e.g. c:\mysource\projectb\packages\projecta.1.2.3.4)
  4. make required changes project (b)

the commit process still same, project (a) needs committed first, , in project (b) nuget reference (a) needs upgraded.

the first approach neater because process warns if there faults in nuget package of (a) (e.g. forgotten add new assembly) while in second process developer won't know until after package (a) has been published.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -