Home » Visual Studio » Using NuGet to Distribute Company Internal DLLs

About Juri Strumpflohner

Juri Strumpflohner

Using NuGet to Distribute Company Internal DLLs

Releasing new software has to be simple and super fast! That was not the case for our company-internal class libraries till a couple of month ago until I finally decided to take the time to optimize that release process. At the company where I’m working at currently, we have an internal class library which bundles a series of utilities with the scope of helping devs doing their day-to-day job. So far so good, however, there has always been a thing that puzzled me right from the beginning was the cumbersome release process of that library.Creating a release bundle consisted in

  • incrementing the version number in the AssemblyInfo
  • building the library project in release mode
  • opening the bin folder
  • zipping the dlls
  • uploading the zip to our company-internal wiki page with a version history of the release

That’s really tedious, isn’t it? It sometimes took longer to create a new release than to fix a bug. So a couple of months ago I decided to optimize that: using NuGet. If you’re a .Net dev you for sure already heard about it. NuGet is a Visual Studio extension that makes it easy to install and update third-party libraries and tools in Visual Studio. When you use NuGet to install a package, it copies the library files to your solution and automatically updates your project (add references, change config files, etc.). If you remove a package, NuGet reverses whatever changes it made so that no clutter is left.

http://nuget.org/ 

The idea was to create a local, company-internal NuGet repository.

Setting up a company-internal NuGet Repository

That turned out to be simpler than expected. Creating a local NuGet repository is as simple as creating a folder on some network share and to deploy all of your NuGet packages there.

Configuring Visual Studio

In order for NuGet to also search on your private repo you need to add the URL to the repository in your NuGet Package Manager Settings under Tools > Library Package Manager > Package Manager Settings.

When you now invoke the Nuget Package Manager on a Visual Studio Project or Solution you should also see your private repo listed as a possible source:

You’re ready! You can now start packaging your class libraries and dlls as NuGet packages.

Automate to the death?

I’m not going to write on how to create NuGet packages as NuGet has excellent docs on this. What I did is to create a .nuspec file for the class library and then a nice publishRelease.bat containing something like

msbuild Siag.Base.csproj /target:Rebuild /property:Configuration=Release 
nuget pack Siag.Base.csproj -Symbols -Prop Configuration=Release
move *.nupkg \\snip\snip\NuGetRepository

Releasing today means…

  • Incrementing the version number in the AssemblyInfo.cs
  • double-clicking on the publishRelease.bat

Posts you might also be interested in… .net

  • ASP.net MVC3: Doesn’t Deserialize Nullable Properties from Json
  • Don’t Fall into the IEnumerable<T> Trap
  • Writing IoC Supported Integration Tests using AutoFac

Reference: Using NuGet to Distribute Our Company Internal DLLs from our NCG partner Juri Strumpflohner at the Juri Strumpflohner’s TechBlog blog.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments