6

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());
}
Larry G. Wapnitsky
  • 1,216
  • 2
  • 16
  • 35

1 Answers1

1

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
Community
  • 1
  • 1
Todd Main
  • 28,951
  • 11
  • 82
  • 146
  • I have code similar to this that I gleaned from an old posting by Ken Slovak, but I'm still getting all zeroes. I can post my code if that will help, but it's multiple files. – Larry G. Wapnitsky Oct 27 '11 at 14:47
  • 2
    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 – Larry G. Wapnitsky Oct 27 '11 at 15:10