This project has moved and is read-only. For the latest updates, please go here.

[ComRegisterFunction] and [ComUnregisterFunction] in netoffice examples

Feb 25, 2013 at 3:07 PM
Hi, I'm trying to get a better understanding of NetOffice and COM. One thing I have noticed is that in almost all the examples of using NetOffice I find, the [ComRegisterFunction] method creates some registry keys, but the [ComUnregisterFunction] method tries to remove different keys. To me this looks like a mistake, but I'm not sure.

Take this example:

The register function creates 3 keys, the unregister function removes 1 of those 3 keys, and another key that was never explicitly created:
@"CLSID{" + type.GUID.ToString().ToUpper() + @"}\Programmable"
Feb 28, 2013 at 9:36 AM
Hmm, no replies, maybe because I didn't make my questions clear :P
Should the the ComUnregsiterFunction remove the keys created in the ComRegisterFunction?
Also, the "Programmable" key that the [ComUnregisterFunction] cleans up, is that a key that is created behind the scenes? Are there any more that need to be cleaned?
Feb 28, 2013 at 5:52 PM
I don't know much about this but you can examine what keys does regasm utility create without using ComRegisterFunction and what is left afer unregistering assembly.
Mar 1, 2013 at 10:23 PM
Edited Mar 1, 2013 at 10:25 PM
the Programmable key is missing in the register method example. thanks for suggestion.
moreover the the example creatse the codebase entry 2 times (copy+paste error)
regasm.exe create some reg keys for you and call the register method.
the register method create some sub keys now for the new key.

regasm delete the root key and its created subkeys automaticly (unregister)

the office addin key is the same in register/unregister (not?)