Renat Tlebaldziyeu

Deploying per-user Office extensions via an MSI installer

This is part 2 of the series that covers all possible ways of deploying Add-in Express based Office extensions. Part 1 provided a brief overview of the available deployment technologies and now we are going to have a close look into deploying per-user Office extensions via an MSI installer.

Step 1. Set RegisterForAllUsers = false

If you develop a per-user COM add-in or an RTD server, set the RegisterForAllUsers property of your AddinModule or RTDServerModule to False, otherwise go to Step 2.

Set RegisterForAllUsers property

Step 2. Build your project

If you want to support Office 2010 32-bit and 64-bit applications, set the Platform target property to “Any CPU” before building your project.

Setting the Platform target property to Any CPU

Note. If you use a 32-bit component in your Office extension (say a native-code DLL, ActiveX DLL , or .NET assembly), you should compile with the “x86″ target platform. But please keep in mind that your Office extension will work in Office 2000 – 2010 (32-bit) only and will not work in Office 2010 (64-bit). Similarly, if you use any 64-bit third-party components, you should compile with “x64″ but your Office extension will work in Office 2010 (64-bit) only.

Summing up, if you use a bitness-aware component, your extension will work for Office versions of that bitness only.

Step 3. Create a setup project

Add-in Express provides the setup project wizard accessible via Project | Create Setup Project menu in Visual Studio as well as via the context menu of the project item in the Solution Explorer window (shown below).

Create a setup project item

In the New Setup Project Wizard dialog fill in all the necessary fields (Title, Description, Product name and Company) and click the Next button.

New Setup Project Wizard, step 1

On the next step you can choose the localization of the installer UI, the file name and output directory of your setup project.

New Setup Project Wizard, step 2

Click the Finish button. This creates a new setup project.

Step 4. Check the DefaultLocation property

Select your setup project in the Solution Explorer window and open the File System Editor. Select the Application Folder node and check the DefaultLocation property. By default, the setup wizard sets the DefaultLocation property to the user application data folder as follows:


DefaultLocation property

Step 5. Check custom actions

Select your setup project in the Solution Explorer window and open the Custom Actions Editor.The followingcustom actions should be present in your setup project:

Install: adxregistrator.exe /install=” {Assembly name}.dll” /privileges=user

Rollback: adxregistrator.exe /uninstall=” {Assembly name}.dll” /privileges=user

Uninstall: adxregistrator.exe /uninstall=” {Assembly name}.dll” /privileges=user


{Assembly name} is the assembly name of your Office extension, such as COM add-in, RTD server, Smart tag, XLL, or Excel Automation add-in.

Custom Action for adxregistrator.exe

If any of the custom actions is missing, you need to add it. Pay attention to the /privileges command line switch, its value should be set to “user (without quotation marks).

Step 6. Set PostBuildEvent

Select your setup project in the Solution Explorer window and edit the PostBuildEvent property as follows:

“{Add-in Express}\Bin\adxpatch.exe” “$(BuiltOuputPath)” /UAC=Off /RunActionsAsInvoker=true


{Add-in Express} is the full path to the installation folder of Add-in Express.

This executable patches the generated .MSI in the following ways:

  • it hides the “For Me” and “For Everyone” choice in the installer UI. Hiding these options is required because the installer will fail if the user running the installer doesn’t have permissions to install for all users on the PC.
  • it turns off the dialog asking for administrative privileges; the UAC dialog pops up when a non-admin user runs a setup.exe on Vista/Windows 7/Windows 2008 Server. Switching off the dialog is required because entering the admin credentials will install the Office extension for the administrator and not for the current user.

The option /RunActionsAsInvoker=true guarantees that the installer will be run with the privileges of the user who started the installer and not with the system privileges. This setting allows bypassing the AlwaysInstallElevated policy, which is described here.

PostBuildEvent property

Step 7. Add prerequisites (optional)

Open your setup project properties (menu Project | Properties) and click the Prerequisites button. This opens the Prerequisites dialog:

Prerequisites dialog

If you add any prerequisites to your setup project and the “Create setup program to install prerequisite components” option in the Prerequisites dialog is checked, Visual Studio will generate the setup.exe (bootstrapper) file, which will comprise all information about the prerequisites. Running the setup.exe is essential for the prerequisites to get installed. But see Step 9 below.

Step 8. Build the setup project

Build your setup project and deliver all generated files to the target PC.

Step 9. Running the installer

Please keep in mind that installation / uninstallation of an Office extension requires closing the host application.

To run the installation on the PC, you need to choose whether to runthe .MSI or setup.exe. Let’s consider both options.

When the setup.exe is launched, it checks whether the prerequisites are already installed. If a prerequisite is missing, the bootstrapper installs that component. If all the prerequisites are already installed, the .MSI installer launches.

When the .MSI is launched, the extension will be installed but might not run if any prerequisite is missing.

Note! If you deploy prerequisites requiring administrative permissions, the end user will get an UAC dialog asking for administrator credentials. But entering the administrator credentials will install your Office extension for the administrator and not for the current user. Because it is impossible to impersonate the user running the installer after admin credentials are provided, this makes combinations of per-user Office extensions and prerequisites almost useless.

Step 10. Installing a new version of the Office extension

You need to change the assembly version of your Office extension as well as the version of the setup project and rebuild it. The user needs to uninstall the previous version before installing the new one.

Note. Don’t change the Product code property of your setup project. By default, when you change the Version property of your setup project, Visual Studio shows a dialog recommending that you change the Product code. Click No or Cancel in this dialog because if you change the Product code, you will get a new Office extension installer, consequently the previous version of your extension may not uninstall correctly when the user launches the new version installation.

Post a comment

Have any questions? Ask us right now!