'Microsoft.VisualBasic.ComClassAttribute' cannot be applied to '<classname>' because it is not declared 'Public'

A class is declared with ComClassAttribute, but its declaration does not specify Public.

To be eligible for COM interop, a .NET Framework class must satisfy the following requirements:

  • It must be Public, all its containers must be Public, and it must expose at least one Public member.

  • It must not be abstract, that is, it must not be declared with MustInherit.

  • It must not be generic or be declared within a generic container type.

Error ID: BC32509

To correct this error

  • Add the Public keyword to the class declaration.

    -or-

  • If the class or its containing element cannot be Public, then remove ComClassAttribute from the class declaration. You cannot expose it to COM.

See Also

Reference

Public (Visual Basic)

ComClassAttribute

Other Resources

COM Interop