This article presents a method of using the RegFree feature even with COM client applications. RegFree is a new capability of Windows to use a local XML file rather than the Registry for the interface details.
Note: "Registry Free" COM is available only on Windows XP SP2, Windows Server 2003, or newer Windows OSs. If you are working with one of these, then you can take advantage of the following method from both your unmanaged applications (COM) as well as your managed ones.
Prior to .NET, COM components needed to be globally registered on the machine. It was assumed that any new version of a component would replace the previous version, but maintain compatibility with the older version's clients. The term DLL Hell arose to describe the situation in which that compatibility was not preserved. Here is an example of such a situation:
- Your application requires the latest version of a third-party OCX.
- An application on your customer's machine requires an older version of that third-party OCX.
- Neither application works with the OCX version required by the other application.
How to Create the XML Manifest
RegFree COM works by expressing all of the standard component registration information that is typically installed into the system Registry in a file that can be stored in the same folder as the application itself. Getting this file is the difficult part. Luckily, Visual Studio 2005 can do 99% of the work required regardless of whether your client is .NET or VB, or even if you are not the developer of the client.
The method is to create a dummy project (named "Dummy") in VS 2005, set a reference to the COM component(s) you wish to create the XML manifest for, and set its "
Isolated" property to
When you build the project, the bin/debug or bin/release folder will then have a file titled "Dummy.exe.manifest".
- Rename the "Dummy" portion of this file to match your executable.
- Open the manifest, and search and replace "Dummy" with the name of your executable.
- Finally, place the file in the same location as your executable, along with the copy of the third party component(s) that you require.
Now, it doesn't matter what version of that third-party component is registered on the machine, your application will always use the one in its executable directory.