Dealing with the latest form of DLL hell

I’m working on a project which integrates a lot of legacy C++ code in several DLLs with a C# wrapper application.  Of course, the legacy code also references several third party libraries, just to make things interesting.

Everything was going well until I tried to run the application on a test VM and it displayed a very unhelpful error message:

This application has failed to start because the application configuration is incorrect.  Reinstalling the application may fix this problem.

The first thing I discovered, was that in order to run exectutables on a test machine that are linked to the DEBUG versions the VC runtime libraries, I’d need to copy the appropriate folders from the C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\Debug_NonRedist folder to the executable’s directory on the test machine.  Here’s some relevant information on MSDN regarding this:

http://msdn.microsoft.com/en-us/library/aa985618(VS.80).aspx

Unfortunately this was just the tip of the iceberg.

After copying the correct runtime library DLLs, I was still greeted with the same error when I tried to run my application.  The system event log contained a clue in the form of a SideBySide error:

A component version required by the application conflicts with another component version already active.

Hmm.  Some component wasn’t playing nice with some other component!

After a lot of googling, I ran across this Stack Overflow question which led to the eventual resolution:

http://stackoverflow.com/questions/59635/app-does-not-run-with-vs-2008-sp1-dlls-previous-version-works-with-rtm-versions

Apparently, some of the third party libraries were causing the linker to reference older VC runtime library versions, so our component’s manifest file was listing multiple versions.

This was apparently what was causing the problems on the test machine.

The fix was to add the following to the pre-processor directives for each of our projects which forces everything to reference the latest runtime libraries:

_BIND_TO_CURRENT_VCLIBS_VERSION

If you run into this, pay attention to this paragraph from the accepted answer which details a great way to debug this problem:

A great way to debug which libraries don’t have the preprocessor directives set: temporarily modify your platform headers so that compilation stops when it tries to embed the old manifest. Open C:\Program Files\Microsoft Visual Studio 9.0\VC\crt\include\crtassem.h. Search for the ’21022′ string. In that define, put something invalid (change ‘define’ to ‘blehbleh’ or so). This way, when you’re compiling a project where the _BIND_TO_CURRENT_CRT_VERSION preprocessor flag is not set, your compilation will stop and you’ll know that you need to add them or made sure that it’s applied everywhere.

This tip really helped me to identify and correct the projects which where causing the problem.

It’s amazing to me how far we’ve come from the days when this type of problem was routine.  With the advent of .NET, this sort of thing is rarely a problem until you try to use some old C++ libraries.  I hope you never have to deal with this sort of thing!

Posted in Dotnet, Software Engineering | Leave a comment

Launching your .NET app after setup completes

Here’s a better way to accomplish this than what I previously posted:

http://blogs.msdn.com/b/astebner/archive/2006/08/12/696833.aspx

Posted in Dotnet, Software Engineering | Leave a comment

Google Cheat Sheet

Did you know there is a Google Cheat Sheet?

http://www.google.com/help/cheatsheet.html

Learning these simple search operators can really help you fine tune your Google searches!

Posted in Computers | Leave a comment

Motorsports Stack Exchange Proposal

I’ve created a proposal for a new Stack Exchange site dedicated to Motorsports topics.

If you’re interested in Motorsports, please go to this link to support the proposal:

http://area51.stackexchange.com/proposals/16743/motorsports?referrer=7UHqEGIyNMKdz1huO7wB5w2

Please follow the proposal and add some example questions, then vote on the merits of the existing questions.

Once the proposal enters the commitment phase, please Commit to it to show your support!

Posted in Motorsports | Leave a comment

etrailer.com

We just ordered a new bike rack from etrailer.com this morning and they shipped it in a matter of a couple of hours!  Now that’s fast service!

Posted in Motorsports, Vendors | Leave a comment

.NET Logging Library

I was researching which logging libraries are available for .NET today for a new project I’m involved with and it looks like NLog is a nice option to choose:

http://nlog-project.org/

It has a nice tutorial and is very easy to integrate and customize.

Posted in Dotnet, Software Engineering | Leave a comment

Allman Indent Style in Xcode

If you would like to change your Xcode environment to use the Allman indention style (opening curly braces go on a new line), simply run this command from terminal:

defaults write com.apple.Xcode XCCodeSenseFormattingOptions -dict BlockSeparator \\n

Thanks to Scyanide’s World for this tip!

Posted in Mac, Software Engineering, iPhone | Leave a comment

iOS4 is now available!

iPhone OS version 4 (iOS4) is now available.  More information is available here:

http://www.apple.com/iphone/softwareupdate/

You can download the update from within iTunes.

Posted in Technology, iPhone | Leave a comment

Macs are Cool

OK, as I’m sure some of you are already well aware, but just to reiterate:  Macs are Cool.

As a Windows guy for the past twenty years or so, I’ve been using Macs more and more lately.  I purchased one of the new 17-inch MacBook Pros recently, and I’ve really been enjoying the capabilities.

I’m a fan of VMWare as well.  It’s a great product that allows you to run other operating systems in a virtual machine, which makes it great for me when I need to test software on some other OS.

I’ve been running Windows 7 on my MacBook under VMWare, and although it is certainly useable, the performance hasn’t really been blowing my hair back, so I decided to try using Apple’s Boot Camp to run Windows natively on a separate partition.

After setting up Boot Camp, I booted back into OS X and when I ran VMWare, I discovered it had the capability to virtualize my boot camp partition under OS X!  This means that when I want the raw speed, I can boot into native Windows, but otherwise I can still launch the same OS under VMWare on OS X.

That’s just cool.

Posted in Mac, VMWare | Leave a comment

The new MacBooks are here!

Apple has updated the MacBook pros with the latest Intel i5 and i7 processors this morning.

The 15 inch MacBook pro is now available with an 2.4 or 2.53 GHz i5 or a 2.66 GHz i7 Processor, and the 17 is now has the 2.53 GHz i5 processor.

http://www.apple.com/macbookpro/

Posted in Mac, Technology | Leave a comment