05 December 2010

Visual Studio C++ 2005 Side by Side DLL Configuration Errors

Previously, I had experienced the "modern" Windows 7 version of DLL Hell, ie, the Side by Side Configuration errors.  I had to reinstall Win7, so I had to experience this Side by Side DLL Hell all over again...  So here's a better and quick explanation of how to fix it:

Programs compiled in Visual Studio C++ may have a number of dynamic link library dependencies.  The dependency is specific down to the version of a library, so the Side by Side (SXS) feature allows Windows to manage having multiple versions of a library available for programs to link to.  These libraries are stored at C:\Windows\winsxs (so you can go have a look and see if you have a particular library needed).

Usually, programs so compiled have a manifest file of what dependencies is needed embedded in the binary of the compiled program.  You can ask Visual Studio to compile with the manifest file split out as a separate XML file by, in Visual Studio, going to Project > Properties > Manifest Tool > Input and Output, and setting the Embed Manifest option to No.  Then compile the program, and opening the XML file, your_program_name.exe.manifest, in any text editor.  It'll tell you which library you need, and which version.

For me, it turns out I needed two different versions of both the C/C++ standard libraries, and the MFC libraries.  After much searching, I found where you can download them from Microsoft:
"Normally," given that you have Visual Studio installed, you should have the necessary copy of those libraries available for redistribution to users without the necessary libraries in your Bootstrapper folder: C:\Program Files (x86)\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x.  But for whatever reason the copy I have there doesn't have the right version.

 Finally, there is some relevant discussion here.

No comments: