All public classes are registered for COM interop?

A

Alex

Hi,

In my C# IDTExtensibility2 add-in, all the public classes end up registered for COM interop.
Is there a way to ensure that *only* the class that implements ..Connect() is registered?

Best wishes,
Alex.
 
P

Peter Huang [MSFT]

Hi

By default, the ComVisible is set to true.
If you do not want the behavior, you may try the set the attribute in the
AssemblyInfo.cs
[assembly: ComVisible(false)]

In this way, all the type in the assembly will not be exposed.

So we need to enable it for the connect class to expose it.
Change it as similar with below, so that only the Connect will be exposed.
[GuidAttribute("AC885D0A-5D14-42A7-9B9C-6A1D5DBB5368"),
ProgId("WordAddin1.Connect"),ComVisible(true)]
public class Connect : Object, Extensibility.IDTExtensibility2

You may have a try.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Top