.NET project architecture of Office addin /
plugin in Visual Studio: C#, VB.NET, C++

Add-in Express™
for Microsoft® Office and .net

Architecture of Add-in Express projects

Each Add-in Express solution is an ActiveX library (DLL, an in-process COM server) that contains one or several Automation objects which implement the interfaces required by the supported technology, e.g. IDTExtensibility2, IRibbonExtensibility, IRtdServer or ISmartTagRecognizer. By default, every project based on Add-in Express includes two projects: the add-in project itself and its setup project that can be used to deploy your addin.

A sample Add-in Express solution

Component-centric programming model

Add-in Express adds a special module to your project - the add-in module - which is the heart of the Add-in Express framework and your Office addin project. It implements all necessary COM interfaces and contains a lot of application-specific code that takes care of all features and pitfalls of the target application(s). The add-in module is also a container for all components such as toolbars, menus, ribbon tabs, event helpers as well as for any other components (for example, your DB-aware components). So, the AddinModule is a central module for your projects where you place Office-specific and any other components, write your applied code and build the main logic of your MS Office addin. Sure, this main module is a component itself and has a visual designer; its properties and events are available in the Properties window.

Module designer window

Remember, whenever you need to do some task, you add a special component to the add-in module and create a new event handler. So, all your work is centered around this main module, around components added to the add-in module and their events. For example, the addin module publishes several addin- and application-specific events such as AddinStartupComplete, NewMail, NewInspector, RibbonBeforeCreate, etc. Thus, to add your code on the add-on start-up, you create an event handler of the appropriate event of your add-in module. More about Add-in Express components: Menu, command bar, ribbon components and Office Ribbon and Toolbar designers.

Code example of the add-in module

Below you can find an example of the initial source code generated by Add-in Express (some automatically generated regions are collapsed), which will be the base code of your Office plugin:

Imports System.Runtime.InteropServices
Imports System.ComponentModel
Imports System.Windows.Forms
Imports AddinExpress.MSO

'Add-in Express Add-in Module
<GuidAttribute("03D77862-AC4C-4B56-91CD-41BBC04A4911"), ProgIdAttribute("MyFirstOfficeAddin.AddinModule")> _
Public Class AddinModule
    Inherits AddinExpress.MSO.ADXAddinModule

#Region " Component Designer generated code. "
    'Required by designer
    Private components As System.ComponentModel.IContainer

    'Required by designer - do not modify
    'the following method
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Me.AddinName = "MyFirstOfficeAddin"

        Me.SupportedApps = CType(( _
            AddinExpress.MSO.ADXOfficeHostApp.ohaExcel Or _
            AddinExpress.MSO.ADXOfficeHostApp.ohaOutlook _
            ), AddinExpress.MSO.ADXOfficeHostApp)
    End Sub

#End Region

#Region " Add-in Express automatic code "

    'Required by Add-in Express - do not modify
    'the methods within this region
#End Region

    Public Sub New()

        'This call is required by the Component Designer

        'Please add any initialization code to the AddinInitialize event handler

    End Sub

    Public Shared Shadows ReadOnly Property CurrentInstance() As AddinModule
            Return CType(AddinExpress.MSO.ADXAddinModule.CurrentInstance, AddinModule)
        End Get
    End Property

    Public ReadOnly Property ExcelApp() As Excel._Application
            Return CType(HostApplication, Excel._Application)
        End Get
    End Property

    Public ReadOnly Property OutlookApp() As Outlook._Application
            Return CType(HostApplication, Outlook._Application)
        End Get
    End Property

End Class

Your Office solutions are secure, isolated, deployable and updatable

In accordance with a strict Office security policy, Add-in Express isolates each of your extensions into a separate application domain and allows you to unload your managed extensions on the fly not affecting any other add-ins installed on the end-user's machine. To isolate your Office extensions, you use the Add-in Express Loader delivered with Add-in Express, which can be signed by your own digital certificate.

Deploy your Office solutions effortlessly

All setup projects generated by Add-in Express support the rigorous Windows 7, Windows 8 and Office security models, contain all necessary prerequisites and are completely compatible with the ClickOnce technology.