Generate manifest files for registration-free COM

It looks like the perfect solution does not yet exist. To summarize some research:

Make My Manifest (link)

This tool scans a VB6 project to look for COM dependencies, but it also supports manual declaration of late-bound COM dependencies (i.e. those used via CreateObject).

Interestingly enough, this tool puts all information about the dependencies inside the application manifest. The application exe and its dependencies are described as a single assembly consisting of multiple files. I hadn’t realized before that this was possible.

Looks like a very good tool but as of version 0.6.6 it has the following limitations:

  • only for VB6 applications, starts
    from VB6 project file. Shame, because
    a lot of what it does really has nothing to do
    with VB6.
  • wizard style application, not
    suitable to integrate in a build
    process. This is not a huge problem if your
    dependencies don’t change a lot.
  • freeware without source, risky to rely on it because it could become abandonware at any moment.

I did not test whether it supports .NET com libraries.

regsvr42 (codeproject link)

This command line tool generates manifest files for native COM libraries. It invokes DllRegisterServer and then spies on the self-registration as it adds information into the registry. It can also generate a client manifest for applications.

This utility does not support .NET COM libraries, since these don’t expose a DllRegisterServer routine.

The utility is written in C++. The source code is available.

mt.exe

Part of the windows SDK (can be downloaded from MSDN), which you already have if you have visual studio installed. It is documented here.
You can generate manifest files for native COM libraries with it like this:

mt.exe -tlb:mycomlib.ocx -dll:mycomlib.ocx -out:mycomlib.ocx.manifest

You can generate manifest files for .NET COM libraries with it like this:

mt.exe -managedassemblyname:netlib.dll -nodependency -out:netlib.dll.manifest

However, there are some problems with this tool:

  • The first snippet will not generate
    progid attributes, breaking clients
    which use CreateObject with progids.
  • The second snippet will generate
    <runtime> and <mvid> elements
    which need to be stripped out before
    the manifests actually work.
  • Generation of client manifests for
    applications is not supported.

Maybe future SDK releases will improve this tool, I tested the one in the Windows SDK 6.0a (vista).

Leave a Comment