A common need in .NET development is strong-naming an assembly. This is particularly helpful when making that assembly available to any application running on the same computer. Over the next several posts, I’m going to describe the trials and tribulations of creating a strong-named assembly and registering it for system wide use in the Global Assembly Cache. I make it sound easy now, but if you stick with me till the end I’m sure that will change. If you were hoping for a dry, technical post, you’re in luck: there’s plenty of technical stuff coming up. If that’s not what you wanted, you’re also in luck, because I’m going to tell this tale as an allegory. Before we go too much further, let’s cover some basic terminology.
Assembly – The smallest unit of deployment in a .NET application. The code can be compiled into either a dll or exe.
Strongly Named Assembly – An assembly that has been signed with a Private/Public key pair. The assembly’s strong name is comprised of
Simple text name
Culture information (defaults to neutral if nothing is provided)
A public key token and digital signature
Common Language Interface (CLI) – Microsoft’s virtual runtime environment that works similarly to the way Java works with bytecode. Any of the common .NET languages can be compiled to run in the virtual runtime environment rather than a language specific runtime which is what makes it common.
Global Assembly Cache (GAC) – A CLI released with .NET Framework 2.0 to help move away from the Registry. This CLI is a central repository available to every application/assembly running on the machine for the purpose of sharing code.
Some savvy .NET developers may have picked up on what I’m hinting at. For the rest of you, I am describing what I call the 12th labor of Hercules except for a scrawny and pasty-white programmer and not a muscular demigod with magnificent bone structure. Hercules and I descended into our respective hells; mine was DLL Hell. I also had to overcome a three headed demon to be successful. For the purpose of this allegory, I’ll let the three heads represent Strongly Naming an Assembly, the Global Assembly Cache, Third-Party Dependencies, and outdated systems. I know what you’re thinking: “that’s 4 heads”. But as they say, the 2 hardest parts of coding are cache invalidation, naming variables, and off by one errors.
I’ll resist going any further into this post, as this story can get out of control very quickly. Next time I’ll set up the situation and explain what I was trying to do and how the long descent into DLL Hell began. I’ll also be creating the roadmap for my journey in and out of DLL Hell.