Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make my GUID visible for a VSTO Add-in

I've tried adding the following code to the beginning of my add-in code as such:

Namespace NS
    [Guid("211B3945-E2AE-48DD-8A9A-77ADB40EC6D5")]
    [ComVisible(true)]
    public partial class Classname
    {

but it doesn't appear when I list the COMAddins (the name does, but not the GUID).

I've also tried setting it in my compile settings under Assembly information with no luck.

BTW - the issue I'm trying to resolve is seeing if a COM Addin is loaded by searching for its GUID. The Addin description shows up when I check the list of ComAddIns, but the GUID still shows zeroes no matter how I follow these directions. I'm trying to see what's visible by using the following code:

olApp = this.Application;
Office.COMAddIns CAIs = olApp.COMAddIns;
foreach (Office.COMAddIn CAI in CAIs)
{
    StringBuilder sb = new StringBuilder();
    sb.AppendLine(CAI.Description);
    sb.AppendLine(CAI.Guid);
    sb.AppendLine("****");
    Debug.Print(sb.ToString());
}
like image 270
Larry G. Wapnitsky Avatar asked Oct 13 '11 14:10

Larry G. Wapnitsky


1 Answers

There are a number of things missing here to expose COM, including overriding RequestComAddInAutomationService and setting [InterfaceType(ComInterfaceType.InterfaceIsDual)]

See the following items:

  1. VSTO Add-ins, COMAddIns and RequestComAddInAutomationService
  2. VSTO in VBA: AddIn.Object returns Nothing (null) sometimes
like image 111
Todd Main Avatar answered Oct 07 '22 03:10

Todd Main