DLL Hell Redux One way around the latest dynamic link problem By Dino Esposito

emember the notorious DLL In addition to top commercial suites not, you must first download binaries Hell problem? About a of user interface controls, you’ll find to the development machine and then decade ago, before the ad - quite a few well-done, free open browse your hard disk in order to ref - vent of the .NET platform, source libraries . erence them in the new project. Rmost applications were based on dy - Increasingly, .NET software projects Sometimes you must repeat the oper - namic link libraries, and multiple apps are based on a variety of third-party ation for multiple assemblies. And often shared DLLs. components. On average, a project sometimes you also have to enter At that time, DLLs were identified can use six or seven of them. For ex - changes in the configuration file of the primarily by name, and version info ample, an ASP.NET MVC project may .NET application and add ad hoc often wasn’t recorded properly. If a have an IoC framework, a mocking li - source files to the project. With few new application inadvertently re - brary, ELMAH or something similar exceptions, referencing a third-party placed a shared DLL component, for error handling, perhaps the Mi - component is painful. other apps that used that component crosoft Enterprise Library, DotNe - would break. The solution to this tOpenAuth for authentication against Free problem came with the .NET plat - social networks, NHibernate or some NuGet is a free package manager form and Global Assembly Cache, Entity Framework extensions, jQuery application aimed at making it easier which gives registered components and friends, maybe some other facili - for developers to reference third- strong names that contain details such ties for mobile and HTML5 views and party libraries from within a Visual Studio project. NuGet provides a command line and GUI front end so NuGet saves developers time packages can be quickly installed and and ensures that they only access uninstalled. It acts as a host for up - loaded packages and lets developers an approved set of libraries . discover them by name and tag-based searches. as version and author information. client-side validation. The list goes on Integrated in Visual Studio 2010, With this problem solved , develop - and on. NuGet lets developers reference a com - ers now are grappling with a new one: There are two problems with third- monly used third-party library with the third-party DLL Hell. party components. Companies must one click. You open the package man - In the beginning of the .NET era, ensure that developers can only use an ager, scroll the list of available pack - applications used only a few commer - approved set of libraries. And develop - ages, pick up the one you’re looking cial third-party libraries, mostly for ers face the problem of repeatedly go - for, accept the license agreement (set user interface needs. The number of ing through the same (often cumber - by the package author, not ), these components per application some) configuration procedure for a and download. was low, and managers knew which given library—a frustrating and time- Each NuGet package contains files ones they were because they had to consuming operation. (sources, data, help, and binaries) to pay for them. Referencing some of these third- be added to the Visual Studio project Today, many more high-quality, party components isn’t as easy as ref - and instructions for the manager. third-party components are available. erencing an assembly. More often than Once the download is complete, the informationweek.com Oct. 17, 2011 47

Copyright 2011 UBM LLC. Important Note: This PDF is provided solely as a reader service. It is not intended for reproduction or public distribution. For article reprints, e-prints and permissions please contact: Wright’s Reprints, 1-877-652-5295 / [email protected] package manager Xcopies the files and open source projects. A large and upload custom packages for others to sets up the project as appropriate. growing number of .NET developers use. And, unlike the Apple App Store This means, for example, that assem - use it, and just the fact that adding a and Windows Phone 7 marketplaces, blies in the package are added to the dependency is so easy represents a there’s no approval workflow for sub - list of existing project references, and good reason to add more third-party mitted packages . changes required to the configuration components and libraries. ( I think NuGet can be configured to point file are merged with the current con - this is similar to what happened in to a shared folder on the intranet , let - figuration file. the ’90s with and VBX ting a company have its own local In a couple of clicks, you’re set. components.) NuGet installation . Developers enjoy NuGet definitely saves time. Companies often put strict bound - the benefits of NuGet, while man - aries around which frameworks agers ensure that developers access Vibrant .NET Community and libraries their developers can only an approved set of libraries. In According to Phil Haack, one of the use, and they often designate a select addition, you no longer need to NuGet architects , the utility’s primary group of people to approve the third- produce internal documentation on goal is to foster a vibrant .NET open party components that can be used. how to locate and install approved source community by simplifying the Open access to NuGet’s repository libraries. way in which .NET developers share doesn’t necessarily break these and use open source libraries. policies. Dino Esposito is the author of a num - In this regard, NuGet was a great NuGet package managers read the ber of books about Microsoft pro - success. Launched less than a year feed of available libraries from a Mi - gramming technology. Write to us at ago, it’s one of the most compelling crosoft website where developers can [email protected]. Windows 8 And Developer Madness Get ready for another costly migration very 10 years or so, Microsoft accumulate, especially for sites that, for like kiosk software with brightly col - informs its programmer com - one reason or another, can’t migrate ored boxy buttons and no complex, Emunity that it’s radically chang - applications to the new platforms. messy features like dialog boxes. ing platforms. In the early 1990s, it (Those that can, of course, still bear the Metro UIs can be written in HTML5 moved developers from DOS-based price of migration, but presumably this and CSS, or by using an XML-like in - APIs to Win32 by forcing them is a one-time cost.) terface definition called XAML. UIs through a painful series of API sub - At least the migration from DOS to written in HTML5 and CSS run on a sets: Win16 to Win32s and Win32g Win32 had compelling motivators: a JavaScript engine; those using XAML to Win32. In the early 2000s came GUI interface and a 32-bit operating talk directly to a new OS library, the push to migrate to .NET. Now system. The migration from Win32 to called Windows Runtime, principally comes a new migration: to Windows .NET had a less obvious benefit: so- using C/C++. 8’s constellation of new technologies called “managed code,” which in Desktop apps can still be written in announced at the Build conference in theory eliminated a whole class of bugs .NET and use Silverlight, for example, September. and provided cross-language portability. but Microsoft hasn’t put forth a long- In both the Win32 and .NET migra - It’s not clear that the first benefit war - term road map for these suddenly tions, Microsoft supported backward ranted rewriting applications, nor that legacy technologies. It has strongly compatibility. But by changing the UI, the second one created lasting value. hinted, though, that the future will limiting updates, and providing dimin - The just-announced Windows 8 look more like Metro and that devel - ished support, Microsoft obliged com - technologies are for writing “Metro” opers must get on board. Given the panies to either rewrite their existing apps. (All previous software is now lack of stated benefits, however, it’s code or, at least, write future code for grouped into the legacy category of hard to see how or why they should go the preferred platforms. desktop apps.) Metro apps have a with the new paradigm, or even why The costs of these past migrations wholly new UI derived from Microsoft’s they should care. have been enormous and continue to mobile offerings and intended to look —Andrew Binstock ([email protected])

48 Oct. 17, 2011 informationweek.com