Deploying Office 2003 Solutions with Windows Installer (Mary Lee)

You may want to develop Microsoft Office 2003 solutions with Visual Studio Tools for Office (VSTO) in Visual Studio 2008 SP1 for several reasons.

  1. Your customers are using Microsoft Office 2003.
  2. Your customers are using both Microsoft Office 2003 and the 2007 Microsoft Office system.
  3. Your customers are using .NET Framework 2.0 and cannot migrate to .NET Framework 3.5.

Once you’re done with development, you’ll want to deploy your Microsoft Office 2003 solutions to your end users. This process involves the following steps:

  1. Check for and install the following prerequisites: .NET FX 2.0, VSTO 2005 SE runtime, and the Microsoft Office primary interop assemblies.  If your client computers already have the prerequisites, or you want to do this manually, you can skip this step.
  2. Copy the customization assembly to the end user computer.
  3. Grant full trust to the customization assembly.
  4. For application-level add-ins only, create a set of registry keys so that the Office application knows to load the add-in.

Due to customer demand, I’ve created five deployment samples that demonstrate these steps. Step 1 is demonstrated in two ways: you can select your prerequisites through the Prerequisites Dialog Box to be installed with the Setup.exe bootstrapper; alternatively, you can configure launch conditions in the Setup project to only install the customization if the prerequisites already exist.

Prerequisites Dialog Box:

Prerequisites Dialog Box 

Launch Conditions editor:

image

You can use the Setup project to complete step 2 by copying the customization assembly and for document-level projects, the document or workbook, to the designated installation location. This is done by adding the project output with the File System Editor. The default installation location in these Setup projects is %PROGRAMFILES%\MyCompany\<Name of Setup Project>.

File System Editor:

image

Full trust is granted by using the SetSecurity project for step 3. This code uses a custom action in the Setup project to create a code access security policy that creates a solution code group for your Office solution, and an assembly code group for the customization assembly.

Custom Actions Editor:

image

Step 4 only applies to application-level add-ins: when you use the Excel 2003 add-in or Word 2003 add-in project templates, there is a Setup project automatically added to your Office solution that already creates the registry keys documented in Registry Entries for Application-Level Add-Ins.

Registry Editor:

image

The process of preparing the development computer for deployment and configuring the Setup project is written out step-by-step in the following two whitepapers:

Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2)

Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer: Walkthroughs (Part 2 of 2)

Now, it’s time to experiment on your own. Download the sample code and the completed installers from the MSDN Code Gallery: http://code.msdn.microsoft.com/VSTO2005SEMSI 

 

Happy deployment!

Mary Lee, Programming Writer.