Search code examples
netoffice

NetOffice - IDTExtensibility2 vs ComAddin


Is there a technical advantage in netoffice by using IDTExtensibility2 vs ComAddin in netoffice? Or do they both accomplish the same thing (although via different paths)?

I'm aware ComAddin inherits from the IDTExtensibility2 interface - I guess my questions is simply - why would I inherit directly from the interface and not from the ComAddin class? More control?


Solution

  • NetOffice doesnt use or works with PIA or VSTO(no need). This is one of advantages from NetOffice.

    The IDTExtensibility2 interface is the common interface for COM based addin in MS-Office. The office application creates an instance from the addin(based on registry informations) and comunicate trough this interface with the addin. you can create an office addin just with implement these interface. (all solutions, addin express, vsto, netoffice do this behind the scene)

    The COMAddin base class in NetOffice is a top-of wrapper to deal with Office trough the IDTExtensibility2 interface and handle the typical infrastructure tasks for you(register/unregister and so on). VSTO does basicly the same but you never see the base class here(during the codeprovider magic, but you can see this in IL Spy oder Reflector)

    The COMAddin base class makes it a bit easier to create an office addin and reduce infrastructure code to be more familar with VSTO - thats the whole idea. Your choice to use it. If you have no exceptional requirements, its a good idea what i find.