COM - Generating a manifest file for COM isolation(registry free)

less than 1 minute read

In order to load COM dll without searching from system registry key, application should include the manifest file in resource so that the application can create an instance of COM object from the specified file directly.

After including this manifest file in your compilation(actually, linking time), it will create the Manifest resouce in your executable application.

.NET COM dll example

1
mt.exe -tlb:MyComNet.dll  -dll:MyComNet.dll -dependency -out:c:\temp\MyComNet.manifest

C++ COM dll example

1
mt.exe -tlb:MyComCpp.dll  -dll:MyComCpp.dll -out:c:\temp\MyComCpp.manifest

If application depends on two dll(one from .NET and one from C++), you can merge the result in one manifest file. After merging, you can verify the result with the following command.

1
mt -manifest Merged.manifest -validate_manifest