Registration-Free COM: A Practical Example

quinnquinn Registered User
edited November 2010 in Axon
yesterday i found this the hard way, but was able to quickly recover without issue. today i’m writing it up because: the Digital Lighting product line is uniquely positioned to benefit from the real value, hidden behind the “fix”. enjoy!

when CMA is installed to a custom location, the StarBurn type library is COM-Registered with an invalid path; burnCDDVDMenuItem_Click() crosses the interop boundary outside of a Try-Catch, and the exception bubbles all the way up and surfaces: WiX can produce these discrepant paths when the file-harvest fragment and the COM-harvest fragment are created separately and later combined: new in Windows XP (and vital for the “cloud”) is a facility for activating arbitrary COM components without the need for them to be registered: Registration-Free COM.

plainly: the two hundred fifty-three StarBurn_CMA Registry rows need not be created correctly as they, in fact, do not need to be created at all.

the COM “plumbing” can instead be delivered in a single, loose file: see .manifest, attached.

to observe the .manifest providing Registration-Free COM interop:
  1. install CMA as usual
  2. create a copy of the “Content Management Application” folder: “Content Management Application - Copy”
  3. uninstall CMA
  4. place ContentManagementApplication.exe.manifest in the “Content Management Application - Copy” folder
  5. Optional: switch to a clean, .NET 2.0, network-attached machine; browse to \\FIRSTMACHINE\c$\Program Files\HighEnd\Content Management Application - Copy
  6. run Content Management Application - Copy\ContentManagementApplication.exe
  7. File > Burn CD/DVD
on Windows XP and above, the .manifest must be in the same folder as the .exe; this particular .manifest also expects the .ocx to be in the same folder.

the only other requirement is: if the COM components advertised by the .manifest happen to be formally registered, those registrations must be valid – Registration-Free COM breaks if bad paths already exist in the Registry.
one example of a .NET opportunity that is impaired by formal COM registration, but can be fully-realized when Reg-Free:
  • CMA could run freely from any UNC path, including USB, SMB or HTTP
  • CMA could run from any of these paths, without having to be installed
  • CMA could be delivered via a ClickOnce installer, which can install and auto-update, without requiring elevation or even an administrator
  • physical units could advertise a ready-to-run, version-matched CMA via Universal Plug and Play or DPWS, which would be presented to standard users for one-time run, install or upgrade, immediately upon connecting to the network, with no manual discovery process required.
(all: provided LmCompatibilityLevel=0 can be eliminated)
installing to a custom location is, admittedly, not yet common, but it is a currently-available option; as such, all components need to be in working order when that option is exercised. getting there just happens to liberate your application from a highly volatile, machine-specific, dependency injection factory, and - at the same time - promotes CMA to one of the only applications in the industry with the early advantage on actually utilizing next-generation platforms (for more than just distribution).
Sign In or Register to comment.