Windows Vista has been available now for a few months and developers are starting to discover the pitfalls of deploying their (older) applications on this platform. Many are finding that dlls used by their applications are failing to install correctly. This failure is due in part to Vista's much publicized User Account Control (UAC).
The affected applications are typically using ATL dlls, which need to be registered on the host OS, prior to the applications being run. Due to Vista's UAC, regsvr32.exe fails displaying an error message and hence the registry keys associated with these application dlls, are not copied to the system registry. When run, applications so affected would either terminate prematurely or fail when features are found not to be available.
To 'fix' the above situation, regsvr32.exe could be elevated to run as an Administrator - this would have to be done for each ATL dll used by a particular application. Alternatively, the application and associated dlls could be converted to employ registry free COM. This feature copies all dll registration information into an XML manifest. Each of these manifest files can then be incorporated into the associated application manifest which, in turn, is compiled into the application executable.
Deployment of an application, which has been altered to support reg-free COM, is much simplified; the executable and associated dlls can be copied directly from the installation media to the target application directory on the host PC. An added bonus is that there should be no need to re-start the system after the installation has completed.
So, having described reg-free COM above, how is an application altered to support it? Well, the good news is that the only changes required are to the application and dll properties, from within Visual Studio. For an ATL dll, you should open the project's property page and expand the Manifest Tool group (figure 1). Then, enter the name of your dll's type library into the Isolated COM section. You should also enter the name of your dll in the Component File Name field.
Figure 1, Manifest Tool Properties
Before building the dll, check that the Generate Manifest and Allow Isolation fields are set to yes in the Linker group/Manifest File section - these are usually set to yes by default. Having performed this check, the dll can now be built as normal and a manifest file will be generated containing XML formatted registration information.
The final step involves incorporating the information contained in each dll manifest into the application manifest. This, at first glance, seems quite daunting but the process turns out to be straight forward. All you need to do is to specify the name and location of each dll manifest in your application's properties (figure 2). To do this, open the application property page and expand the Manifest Tool group. Enter the dll names and paths into the Additional Manifest Files field then check that the Embed Manifest field is set to yes. You are now in a position to build the application.
Figure 2, Additional Manifest Files
You should test the application on a 'clean' system, one on which the application dlls have never been registered. Probably the best way to perform testing of this nature is on a virtual machine running under Virtual PC. Note, if the application or any of the associated dlls have dependencies which have not been copied/installed to the test system, an error box will be displayed complaining about an 'incorrect configuration ...'.
Registry free COM is supported, at the time of writing, on Windows XP SP2, Windows Server 2003 and Windows Vista. The registry free COM configuration steps detailed above refer specifically to Visual Studio 2005.