Tagged: nuget

Deploying NuGet Packages Instead of Zips

I was on a project to improve an application deployment process that used zip files for packaging the applications. Zips are good. They allow you to package and compress files into one bit sized file, but there is so much more to be had with a dedicated package solution.  Maven, gem, wheel, npm, cpan, rpmdebnuget, chocolatey, yum… the list goes on and with so many options to provide an improved package for deployment its hard to justify using plain old zips.

Since this was a .Net project I focused on NuGet. NuGet is itself a zip file, but a zip on steroids. Zip provides the compression and NuGet adds additional meta data and functionality.

  1. Standard package meta data and file layout.
  2. Versioning ala SemVer.org.
  3. Package manager to control install, upgrade, and uninstall.
  4. Dependency management.
  5. Having a package manage file deployment means you have a repeatable process as opposed to manual where one missed file can kill you. Also, when I deploy the same package multiple times the system is in the same state after each deployment, idempotent.

Enough of the sales pitch. Actually, one problem that I had with using NuGet alone was no easy way to validate the package through checksum. So, in addition to NuGet, using a dedicated artifact repository solution like Artifactory gives an added layer of comfort. A good paper, although biased, on Artifactory can be found here.

Happy Packaging!

Setup a NuGet Server

Setting up a NuGet Server is so easy that everyone should do it. Why? If you are beholden to corporate policies that restrict the applications and references your projects can have, you can still benefit from the awesomeness of NuGet by hosting corporate approved packages. If you have a critical build process, you may not want to depend on the reliability of third party servers. Oh, I can keep going, but I won’t. The point is with 5 easy steps (depending on how you may break it down), you can have a NuGet server up and serving packages.

  1. Create an Empty Web Application (I’m using Visual Studio)
  2. Use NuGet to add reference in the Web Application to “NuGet.Server”
  3. Add the nupkg files that you want to host to the Packages folder
  4. Deploy the Web Application
  5. Add the URL of the Web Application to your local NuGet package manager.

Thanks to docs.nuget.org and Adam James Naylor for opening my eyes to how simple this is:



Formalized Versioning

Phil Haack did a post about SemVer 2.0, a formal specification for public API versioning. I think it’s a novel idea as it puts a name and formal structure to what a lot of dev shops I know have been doing. It also allows packaging tools to standardize, like the work Phil talks about with NuGet.

I have added “integrating SemVer and NuGet into CI” to my very long list of things to do for my main side project. That list just keeps on growing.