Pieter van der Westhuizen

Add-in Express vs. VSTO: Office add-in deployment

Planning the deployment of any software product is something most of us leave right to the end of the project. It makes logical sense to do so, everything that needs to be built is built and we know what we need to deploy. Unfortunately, the setup program is also quite often something we do quickly, trusting the Visual Studio tools to take care of all the prerequisites and dependencies.

Visual Studio does a pretty decent job of building setup projects when it comes to non-VSTO projects but one of the major pain areas with VSTO is deployment. In this post, I’ll walk you through some of the steps in building a setup project for a simple VSTO Office Add-in and then I’ll show you how Add-in Express builds the setup project for you. Visual Studio 2005 to 2010, including the Visual Studio Express editions, as well as the latest Visual Studio 2012 are supported:

Building a VSTO Office add-in MSI installer

So you’ve built your next ground-breaking Excel Add-in using VSTO and you’re ready to release it unto an unsuspecting world. The final step in your Excel Add-in World domination plan is to build an installer that your end-users will use to get your add-in running on their machines.

Creating the Visual Studio setup project

In Visual Studio you can add a setup project to your solution as you would any project type: via the Add New Project menu. You then select the Setup Project template.

Adding a setup project to your VSTO solution

The setup project is added to your solution.

The setup project is added to your solution.

Add Project output and manifests

Next, as with any project you need to add the project output to the setup project by right-clicking on the setup project name and selecting Project Output… from the Add menu option.

Adding the project output to the setup project

The setup needs to deploy the application and deployment manifest. You must add these two files to your setup project’s output folder. To do this right-click on the setup project and select File… from the Add menu item. Select the .vsto and .manifest files in your add-ins’ Bin folder.

Adding files to your setup project

Configure the registry

Microsoft Office looks for extension in the Windows registry so in order for your add-in to work, you must create registry keys that specify which user on the PC may use the add-in as well as which Office application should load the add-in. Personally, I don’t mind having to work with the registry but, the windows registry is like the bad part of town…you hardly ever venture there and only if you absolutely have to.

Make sure your setup project is selected in the Visual Studio Solution Explorer and click on the Registry Editor button in the Solution Explorer toolbar.

Make sure your setup project is selected in the Visual Studio Solution Explorer and click on the Registry Editor button

With the registry editor open, add the following key hierarchy under the User/Machine Hive

User/Machine Hive\Software\Microsoft\Office\Excel\Addins\WorldChangingExcelAddin

Add the following values under the WorldChangingExcelAddin key:

  • Description
  • FriendlyName
  • LoadBehavior; and
  • Manifest

Description and FriendlyName is self-explanatory. Setting the LoadBehavior value to 3 will cause the add-in to load when the host Office application starts up. The Manifest value should point to the .vsto file in the target installation directory.

Adding values under the WorldChangingExcelAddin key

64-bit support

Office 2010 64-bit looks for add-in registry keys under the 64-bit hive. To add the registry entries for your add-in under the 64-bit registry hive, you have to set the setup projects’ target platform to 64-bit. This causes a problem when you need to support both 32 and 64-bit installations and results in you having to build two versions of your setup, one for 32-bit editions of Office 2010 and another for 64-bit.

Visual Studio Tools for Office runtime requirements

Microsoft Office 2010 also contains the Visual Studio Tools for Office 2010 runtime, if your add-in targets the .Net framework 3.5, it should run without the need for your setup program to install it. However, if your add-in targets the .Net framework 4, you would need to create a setup launch condition to check for the presence of the VSTO 2010 runtime.

This is of course only true if your add-in target Office 2010, for any earlier versions of Office you would need to deploy the appropriate VSTO runtime.

Primary Interop Assemblies (PIA)

You would also need to deploy the Office Shared Primary Interop Assemblies or PIA. In order to check whether the user already has the appropriate PIA installed, you need to create a custom launch condition if your add-in targets Office version earlier than 2007.

In the case of your add-in targeting Office 2010, you do have the option to download and install the Microsoft Office 2010 Primary Interop Assemblies (PIA) Bootstrapper, which will give you the option to add the Office 2010 PIA as a prerequisite. The Office 2007 PIA can also be added as a prerequisite.

Adding prerequisites

Creating an add-in ClickOnce installer in VSTO

You do have the option to give your users the ability to install your VSTO Add-in using ClickOnce and from what I’ve read; it seems to be the preferred option.

To create a ClickOnce installer, right-click on your project and select Properties from the context-menu. On the Publish tab, you can specify the location you would like to publish the add-in to as well as the URL users would install it from.

Creating a ClickOnce installer

As with the MSI installer you can specify the Prerequisites and use the Options to specify the add-in Load Behaviour.

Building an Office add-in MSI installer with Add-in Express

Creating an installer for your Office add-in that was built with Add-in Express could not be simpler, as with almost all Add-in Express components, it takes a few mouse clicks.

Creating the Visual Studio setup project

In order to create a setup project, simply right-click your project in the Visual Studio Solution Explorer and select Create Setup Project from the context-menu.

Creating a setup project with Add-in Express

Add-in Express will start a New Setup Project wizard that will guide you through the process of creating an MSI installer project, where you can specify details such as the Title, Description and Localization of the add-in.

Specifying Title, Description and Localization of the add-in

Your choice of installer and options

The Add-in Express setup projects also supports InstallShield as well as any 3rd party installers. You also have full control over the installation with custom actions as well as full support for per-user or per-machine deployments.

Adding project output and configuring the registry

The New Setup Project wizard automatically adds the project output and necessary files to the setup project.

The New Setup Project wizard automatically adds the project output and necessary files to the setup project

At this stage your setup project is ready to be built and deployed. Add-in Express takes care of creating the necessary registry entries for you.

Version and platform independent

With the setup project Add-in Express generated for you, you automatically receive a deployment package that supports all Office versions and platforms (x86 and x64), this makes deployment much easier as you only have one setup project to distribute for all configurations.

ClickOnce or ClickTwice : )

Building a ClickOnce installer for your Add-in Express add-in is just as easy as building a MSI installer. Simply select Publish ADX Project from the project context-menu in the Visual Studio Solution Explorer. A Publish dialog will give you the ability to quickly build a ClickOnce installer or an installer for the Add-in Express MSI-based web deployment technology known as ClickTwice : )

Building a ClickOnce installer for your Add-in Express add-in

ClickTwice : ) enables users and administrators to run MSI installation packages from either the internet or their own intranets. Where ClickOnce can only target non-administrator installations, ClickTwice : ) provides an alternative to install and update per-user and per machines Office extensions.

Conclusion

I have to be honest, I knew I was spoiled with Add-in Express’ ease of use and products, but I never realized just how spoiled when I had to create a MSI installer for VSTO. There are so many things to consider and manual actions to be taken into account that you can easily miss something important.

It is also extremely frustrating that the last step to releasing your product and getting it to market is such a big deal when building the VSTO setup project. With Add-in Express building setup projects is really, click and go.

Save yourself a lot of aggravation and get that super world-class Office add-in out of the door with the help of Add-in Express.

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

Last updated: 6-Feb-2013

Add-in Express vs. VSTO:

You may also be interested in:

7 Comments

  • XL-Dennis says:

    Pieter,

    The first thing I was aware of the first time I explored Add-in Express was the deployment process. People who don’t know much of VSTO and managed COM add-ins don’t realize the great thing about Add-in Express, the deployment.

    Kind regards,
    Dennis

  • Pieter van der Westhuizen says:

    Hi Dennis,

    Oh yes…. Deployment can turn into something of a nightmare with VSTO. With ADX, deployment is almost an afterthought.
    I also agree that you do not really appreciate the ease of deployment with ADX until after having to do it manually with VSTO.

    Thank you for your comment!

    -Pieter

  • Michael says:

    Cool~~, this article finally solved my problem!

  • Steve says:

    Hi Pieter, I have very basic knowledge of VSTO and have never used ADX. How can I deployment my project for web download and require the user to have an activation code? Is this possible in ADX?

  • Pieter van der Westhuizen says:

    Hi Steve,

    You can build a click-once installer and then display a activation form the first time the add-in is run. Or you can build what we call a Click Twice installer, which will give you the capabilities of an MSI installer combined with the ease of deployment of Click once.
    You can then build a custom action in your setup to prompt the user to enter an activation code.

    Hope this helps, feel free to ask if you have any more questions.

  • Anindya Chatterjee says:

    Hi,
    Does Add-in express support VSTO projects anymore?

    If it does, can I port my existing VSTO project (an Outlook addin) into it and then re-build it and deploy it targeting multiple platforms?

    thank you
    Anindya

  • Dmitry Kostochko (Add-in Express Team) says:

    Hi Anindya,

    Currently, only one Add-in Express product supports the VSTO platform, it is Add-in Express Regions for Microsoft Outlook and VSTO. Using this product you will be able to customize Outlook views and Outlook forms with any .NET controls in your existing VSTO project.

    If you are interested in migrating a VSTO-based project to Add-in Express for Office and .NET, it cannot be done automatically. You will have to create a new ADX project, and then move your VSTO code there piece by piece.

Post a comment

Have any questions? Ask us right now!