Make Assembly COM Visible?

1,952 views
Skip to first unread message

Yinru Hou

unread,
Jun 16, 2011, 2:29:21 PM6/16/11
to exce...@googlegroups.com
 
Today I checked my C# project, type dll, when I click assembly Information,
There is one check box "Make assembly COM-Visible" and it is checked.
My addin was COM AddIn, now it is excel-DNA addin, not COM any more.
So I unchecked the box, however,  my Ribbon will not show up in Excel.
If I check the checkbox, then my Ribbons show up in Excel.
I am confused now.
and  think maybe there is sth. still not correct in my addin.
 
thanks
 

Govert van Drimmelen

unread,
Jun 16, 2011, 2:39:43 PM6/16/11
to Excel-DNA
Hi Yinru,

Each type in a .NET assembly may be COM visible or not.

The assembly attribute [assembly:ComVisible(true/false)] which is set
through that interface, sets the default visibility for the assembly.
If the assembly attribute is not present, the default is for all
compatible types to be COM visible.

The assembly default can be overridden by a [ComVisible(true/false)]
attribute on the particular type.

The class for your ExcelRibbon (and any RTD server classes and any
UserControls for Custom Task Panes) must be COM visible.

So in your case, you can either make the whole assembly COM-Visible
with the checkbox, or uncheck the checkbox and add the attribute to
your ExcelRibbon class:
[ComVisible(true)]
public class MyRibbon : ExcelRibbon {}


Note that the "Make assembly COM-Visible" checkbox is a totally
different issue to the "Register for COM Interop" build step, which
does registration in the registry of your assembly. This step is not
needed for your Excel-DNA add-in.


-Govert
Reply all
Reply to author
Forward
0 new messages