gomasch Development Notes

Donnerstag, Dezember 13, 2007

COM without Registry - Side-by-Side Assemblies in XP

It's oh so late. I'm discovering registration-free COM!

With Windows XP, the assembly is described by a manifest; the registry is no longer relied upon for storing and accessing the COM activation data.

So finally I can't escape those *** manifests.

Isolated=True in VS2005 already does a bit of the manifest generation work. But for C++ components with custom interfaces (IUnknown instead IDispatch) the manifests may need some patching.

  1. Change dependencyType="install" to dependencyType="preRequisite". Otherwise VS 2005 Setup project still registers the COM dll even if it's set to vsdrfDoNotRegister.
  2. We'd better also mention the proxy-stub-dll.  Described here:
    Problem: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=114083 
    https://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=114083 
    Solution: http://msdn2.microsoft.com/en-us/library/ms973913.aspx#rfacomwalk_topic8

keywords: "Unable to cast COM object" isolated registration free COM vsdrfDoNotRegister asmv2:dependencyType="preRequesite" asmv2:dependencyType="install" dependentAssembly comInterfaceProxyStub

Aftermath: (2007-12-14) It does work with .dlls, but cross apartment calls to a side-by-side OCX don't work for me (OCX built with VC++6). I really have all the comInterfaceExternalProxyStub entries in the manifest, but still I get a System.Reflection.TargetException if I call the OCX functions from .Net from a Non-UI thread. If I call the OCX functions via BeginInvoke all is fine. 
But since I made the experience that the cross apartment synchronization from COM works notably faster than using BeginInvoke.

martin schmidt 16:17 | 0 comments |