Pieter van der Westhuizen

How to install multiple Office add-ins using one setup project

In today’s post I’ll demonstrate how you can install multiple Add-in Express Microsoft Office Add-ins without building multiple setup programs.

Start by creating a new ADX COM Add-in project in Visual Studio.

Creating a new Add-in Express COM Add-in project in Visual Studio

Click OK and on the next screen select your preferred programming language and the minimum supported Office version and click the Next button. Only select Microsoft Word in the list of supported applications and complete the New Microsoft Office COM Add-in wizard.

Go ahead and add two more COM Add-in projects to the solution; one that only targets Microsoft Excel and the other that only targets Microsoft Outlook. Once you are done your Solution Explorer should look similar to the screenshot below:

Adding two more COM Add-in projects: for Excel and Outlook

Add the functionality you require to each add-in. In this example, I’ve added Office application specific ribbon tabs to each project. Be sure to build your projects before proceeding.

Next, create a setup project for the Word specific addin, by clicking on the project and selecting Create Setup Project from the Visual Studio Project menu. You can also add a setup project by right-clicking on the project name in the Solution Explorer and selecting Create Setup Project from the context-menu. The New Setup Project wizard will be displayed, complete the necessary fields and click the Next button.

Creating a setup project for the Word addin

Choose your preferred Localization, file name and output directory and click Finish.

Choosing the preferred Localization, file name and output directory

The wizard will automatically add the Project Output for the Word specific add-in project to the setup project, so you don’t need to do anything extra for the Word specific add-in. Next, right-click on the setup project name in the Solution Explorer and select Project Output… You can accomplish the same by selecting Project Output… from the Visual Studio Project -> Add menu.

Select the Excel specific add-in in the Project dropdown list and click OK.

Selecting the Excel specific add-in in the Project dropdown list

Repeat the process and add the Outlook specific add-in’s project output to the setup project as well. Afterwards the Solution Explorer should look similar to this:

Setup project containing 3 Office COM add-ins

The next step would be to right-click on the setup project name in the Solution Explorer and select View ->Custom Actions from the context menu.

Selecting Custom Actions from the context menu

You’ll notice that there are 3 custom actions already. We need to add a custom action to the Install, Rollback and Uninstall nodes for each of the add-ins we want to install using our setup.

Right-click on the Install node and select Add Custom Action… from the context-menu. Choose Application Folder from the Look in dropdown list, select adxregistrator.exe and click OK.

Adding a custom action to the Install node

Select the new custom action and change its Arguments property to:
/install=”ExcelSpecificAddin.dll” /privileges=user

Repeat the step to add another custom action to the Rollback node, this time set the new custom actions’ Arguments property to:
/uninstall=”ExcelSpecificAddin.dll” /privileges=user

And finally do the same for the Uninstall node and change the new custom actions’ Arguments property to:
/uninstall=”ExcelSpecificAddin.dll” /privileges=user

Repeat the whole process for the Outlook specific project and replace ExcelSpecificAddin.dll with OutlookSpecificAddin.dll. The Custom Actions Editor should look similar to the next screenshot:

Custom Actions Editor

Build and install your setup project. If all went well, you should see all three add-ins installed with the one setup program.

The above scenario is ideal when you have multiple individual add-ins and you want to give your users the option to either install them one-by-one or all at once.

However, Add-in Express does provide you with the option to create one add-in that is able to target multiple MS Office applications. You can either choose all the supported Office applications when you create a new ADX COM Addin Project or if you’ve already created an Add-in or want to add support for another Office application, all you need to do is select the AddinModule and set its SupportedApps property to the MS Office application your add-in needs to support.

Another method of adding support for multiple applications is to add a new COM Add-in Module item to your project and setting its SupportedApps property to the desired MS Office application.

Adding a new module to the existing project

Using this method you can use multiple COM Add-in Modules to separate logic for each support Office application without the need to make any changes to the setup project.

Thank you for reading. Until next time, keep coding!

Post a comment

Have any questions? Ask us right now!