I’m writing a class-library (IE BHO) in C# and currently wrangling with the large volume of what I think is junk output coming from REGASM’s generated registry keys.
The short version is this: I only want to expose a handful of classes (currently: ONE class) to IE (and the rest of COM). Only one class has the ClassInterfaceAttribute and GUID stuff set, and I can test that the add-on only requires the COM registry keys for this class — and yet, REGASM generates GUIDs and registry keys for every class in the entire project.
This is annoying and somewhat disturbing as I do not want my class names sitting in users’ registry unless they absolutely have to be there.
To be fair, many of those other classes are marked public because I use them in a driver app from another project in the same solution, to work around IE’s debugging black hole…
I’m still very green to COM in general (especially relating to .Net) and I was wondering what is the best way to hide all my other classes from regasm? Or, at least, why these classes that — even though they are marked public — are showing up when I haven’t set any of the COM flags for them?
Thanks!
Use
internalaccess modifier for stuff that doesn’t need to havepublicmodifier. For stuff that really needspublicaccess use ComVisible attribute to partially hide it.For example:
All public member functions and member variables of all public classes are COM-visible by default. So first think of making them internal and if you really need them public hide them from COM with ComVisible.