I have some applications (some native, some .NET) which use manifest files so that they can be deployed in complete isolation, without requiring any global COM registration. For example, the dependency on the dbgrid32.ocx com server is declared as follows in the myapp.exe.manifest file which sits in the same folder as myapp.exe:

This all works fine but maintaining these manifest files manually is a bit of a pain. Is there a way to generate these files automatically? Ideally I would just like to declare the application's dependency on a list of COM servers (both native and .NET) and then let the rest be generated automatically. Is it possible?

4 Answers
4

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.

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:

I think you missed one option: mazecomputer.com but I know nothing about it the web site doesn't describe.
–
BobMay 17 '09 at 2:59

MMM will also redirect non-COM (standard) DLLs. I'm not sure the other tools do this.
–
BobMay 17 '09 at 3:04

Just a note for the nervous: the source for MMM has been released. On the downside, this appears to be because the author has decided to stop working on it. Still a positive sign.
–
GavinJul 25 '11 at 4:10

The site for MMM is nolonger up but the place where the source code was put is still available for v0.9 and v0.12.
–
Scott ChamberlainMar 17 at 20:06

With the MSBuild task GenerateApplicationManifest I generated a manifest at the command line identical to the manifest Visual Studio generates. I suspect Visual Studio uses the GenerateApplicationManifest during the build. Below is my build script which can be run from the command line using msbuild "msbuild build.xml"

I think this should really be marked as the answer to this question. I am now using this to automate all of our manifest generation. Thank you @mcdon, you've saved me a lot of work.
–
Pete MagsigJul 25 '13 at 1:55

I agree this is the best solution when building with Visual Studio. It is probably not rated higher only because it was posted so much later than the other answers
–
dschaefferMar 12 '14 at 21:09

Make My Manifest (MMM) is a nice tool for doing this. It's also possible to write a script to process all your DLL/OCX files using mt.exe to generate a manifest for each one and then merge them all together. MMM is usually better/easier, because it also handles lots of special/weird cases.

I'm a bit nervous about this MMM thing; it's just a blog, freeware but no source code available, only a link to a "self-extracting exe" and I see comments about the utility causing XP to crash. mmm...
–
Wim CoenenJan 21 '09 at 22:21

Those "crashes" were the MMM utility itself dying. This was fixed in version 0.6.5 but you'll want 0.6.6 anyway, since while still a beta it no longer expires. You can always use MT.EXE instead though as already suggested.
–
BobJan 21 '09 at 23:19

mt.exe is not generating progid's when I use it on native com servers like dbgrid32.ocx
–
Wim CoenenJan 23 '09 at 1:21

You can use Unattended Make My Manifest spin off to generate manifests directly in automated builds. It uses a script file to add depended COM components. This is an excerpt from the sample ini with the available commands:

+1 Interesting, especially because the source code is available. I'm a bit confused by the name similarity, apparently "make my manifest" and "unattended make my manifest" are different tools by different authors.
–
Wim CoenenNov 20 '09 at 13:15