Export (0) Print
Expand All
Expand Minimize
10 out of 170 rated this helpful - Rate this topic

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

Office 2003

Darryn Lavery, Microsoft Corporation

Lubo Birov, Microsoft Corporation

McLean Schofield, Microsoft Corporation

December 2005

Applies to: Microsoft Visual Studio 2005, Microsoft Visual Studio 2005 Tools for the Microsoft Office System, Microsoft Office Excel 2003, Microsoft Office Outlook 2003, Microsoft Office Word 2003

Summary: Read two walkthroughs about deploying Microsoft Visual Studio 2005 Tools for the Microsoft Office System solutions using a Visual Studio 2005 Setup project to create a Windows Installer package. (19 printed pages)

Download OfficeVSTOWindowsInstaller.msi.

Contents

Overview

This article, the second of two, provides two walkthroughs about deploying a Microsoft Visual Studio 2005 Tools for the Microsoft Office System solution using a Visual Studio Setup project to create a Windows Installer package.

The first walkthrough provides end-to-end steps to create a Windows Installer package for a Microsoft Office Excel 2003 or Microsoft Office Word 2003 solution. The second walkthrough demonstrates how to enhance a Microsoft Office Outlook 2003 add-in to include installing the prerequisites and granting trust to the customization assembly.

NoteImportant:

Before you can start these walkthroughs, you must read and follow the instructions in Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer (Part 1 of 2).

Walkthrough: Creating Windows Installer Packages to Deploy Visual Studio 2005 Tools for Office Solutions

This section describes how to create a Windows Installer package for Excel or Word. Although the example shows you how to deploy an Excel solution, you can use the same steps to deploy a Word solution.

You learn how to:

  • Create a Setup project that you can use to build the bootstrapper and the Windows Installer package.

  • Modify the Setup project so that the Windows Installer file installs your Visual Studio 2005 Tools for Office solution.

  • Add the prerequisites: Microsoft Office 2003 primary interop assemblies, the Visual Studio 2005 Tools for Office Runtime, and optionally, the Visual Studio 2005 Tools for Office Language Pack.

  • Add a custom action to the Setup project to grant security trust to the customization assembly.

  • Add a custom action to the Setup project to edit the application manifest embedded in the Visual Studio 2005 Tools for Office solution document.

  • Add launch conditions to the .msi file to prevent your users from running the .msi file if they have not installed the required prerequisites.

Creating the Project

In this step, you create an Excel Workbook project in Visual C#.

To create a new project

  1. Create an Excel Workbook project in Visual C# with the name ExcelApplication.

  2. Verify that Create a new document is selected.

    Visual Studio opens the new Excel workbook in the designer and adds the ExcelApplication project to Solution Explorer.

Signing the Assembly

Later in this article, you grant trust to the customization assembly based upon a strong name and its location. However, you must first sign the assembly.

To sign the assembly

  1. In Solution Explorer, right-click the ExcelApplication node, and then click Properties.

  2. Click the Signing tab.

  3. Select the Sign the assembly check box.

  4. In the Choose a strong name key file list, click <New. . .>.

  5. Type ExcelApplication into the Key file name box.

  6. Type a password into the Enter password and Confirm password boxes.

  7. Click OK.

  8. Close the Properties pages.

Adding Code Behind the Workbook

In this step, you add a message box to the Microsoft.Office.Tools.Excel.Workbook.Startup event handler of the workbook. This enables you to verify that the solution is working when you open the document.

To add a message box to an initialization event

  1. In Solution Explorer, right-click ThisWorkbook.cs, and then click View Code.

  2. Add the following code to the ThisWorkbook_Startup event handler inside the ThisWorkbook class to show a message box during initialization.

    private void ThisWorkbook_Startup(object sender, System.EventArgs e)
    {
      MessageBox.Show("The document has been deployed successfully.");
    }
    
  3. Press F5 to run the project.

    Excel starts and the message box appears.

  4. Close the message box, and then exit Excel.

Creating a Setup Project

In this step, you create a Setup project that you can compile to create a Windows Installer file for your solution.

To create a Setup project for your solution

  1. In Solution Explorer, right-click the Solution node.

  2. Point to Add on the shortcut menu, and then click New Project.

    The Add New Project dialog box appears.

  3. In the Project Types pane, expand Other Project types, and then select Setup and Deployment.

  4. In the Templates pane, select Setup project.

  5. Name the project ExcelApplicationSetup.

  6. Click OK.

    The Setup project appears in Solution Explorer. By default, the Windows Installer file that you build using this Setup project includes a dialog box that enables the user to specify the installation location of the solution.

Adding the Workbook and Solution Assembly to the Setup Project

In this step, you add the primary output of the ExcelApplication project to the Setup project. The primary output of the ExcelApplication project consists of the workbook and the solution assembly.

To add the workbook and assembly to the Setup project

  1. In Solution Explorer, right-click the ExcelApplicationSetup node.

  2. Point to View on the shortcut menu, and then click File System.

  3. Right-click Application Folder in the left pane.

  4. Point to Add on the shortcut menu, and then click Project Output.

  5. In the Project box, select ExcelApplication.

  6. In the list of output types, select Primary output.

  7. Click OK.

    The project output and dependencies appear in the right pane.

When you add the primary output of a project to the Setup project, Visual Studio detects the dependencies. These dependencies can appear as a list of separate DLLs. Next, you must exclude these DLL dependencies, because they are part of the prerequisite packages and you add the packages as dependencies later.

To exclude the DLL dependencies

  1. In Solution Explorer, expand Detected Dependencies under the ExcelApplicationSetup node.

  2. Right-click every dependency except Microsoft .NET Framework, and then click Exclude.

Adding the Prerequisites to the Setup Project

This step assumes you have prepared the development environment.

Users can use either of the following files to launch the setup process:

  • Setup.exe

    When Setup.exe runs, the bootstrapper executes first. It examines the list of prerequisites needed by the application and installs them if necessary. After the prerequisites are installed, the .msi file is processed, which performs the actual installation of the application.

    NoteImportant:

    Users require administrative rights to install these prerequisites. If they do not have those rights, you must find another method of deployment, for example, group policy or system management software (SMS).

  • An .msi file

    When this executable file launches, the bootstrapper does not execute and the prerequisites do not install. However, it is possible to add launch conditions that prevent installation, if certain prerequisites are not present.

Add the prerequisites that the bootstrapper installs. You add launch conditions in a later step.

To add the prerequisites

  1. In Solution Explorer, right-click the ExcelApplicationSetup node.

  2. Click Properties.

  3. In the Property Pages dialog box, click the Prerequisites button.

  4. In the list of prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio Tools for Office Runtime.

  5. Select Microsoft Visual Studio 2005 Tools for Office Runtime Language Pack, if any users run your solutions with non–English settings for Microsoft Windows.

    These users must have the Visual Studio 2005 Tools for Office Language Pack to see runtime messages in the same language as Windows.

  6. Click OK twice.

Adding a Custom Action to Grant Trust to the Assembly

Before a Visual Studio 2005 Tools for Office solution can run, the customization assembly must have FullTrust permissions. The sample custom action included in the source code accompanying this article demonstrates how to grant permissions to the assembly that is installed on the user's computer.

To add the custom action project to the solution

  1. Using Windows Explorer, copy the SetSecurity project from the {SamplesDir}\projects directory to the directory containing the ExcelApplication Solution.

    NoteTip:

    By default, the SamplesDir directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office Resources\VSTO2005 Windows Installer Sample

  2. In Solution Explorer, right-click the ExcelApplication node.

  3. Point to Add on the shortcut menu, and then click Existing Project.

  4. Select the SetSecurity project.

  5. Click OK.

  6. In Solution Explorer, right-click the SetSecurity project, and then click Build.

  7. Add the primary output of the SetSecurity project to the Setup project.

    This enables the Windows Installer file to run the custom action that edits the security policy on the user's computer.

To add the primary output of the custom action project to the Setup project

  1. In Solution Explorer, right-click the ExcelApplicationSetup node.

  2. Point to View on the shortcut menu, and then click Custom Actions.

  3. In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.

  4. In the Look In list, click Application Folder, and then click Add Output.

    The Add Project Output Group dialog box opens.

  5. Click SetSecurity in the Project list.

  6. In the list of output types, select Primary output, and then click OK.

  7. Verify that Primary output from SetSecurity (Active) is in the list of primary outputs for the Setup project, and then click OK.

  8. Add the required custom action data.

To add the custom action data for the Install method

  1. In the Custom Actionseditor, expand Install.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /assemblyName="ExcelApplication.dll" /targetDir="[TARGETDIR]\" 
       /solutionCodeGroupName="MyCompanyName.ExcelApplication" 
       /solutionCodeGroupDescription="Code group for ExcelApplication" 
       /assemblyCodeGroupName="ExcelApplication" 
       /assemblyCodeGroupDescription="Code group for ExcelApplication" 
       /allUsers=[ALLUSERS]
       
    

To add the custom action data for the Rollback method

  1. In the Custom Actions editor, expand Rollback.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /solutionCodeGroupName="MyCompanyName.ExcelApplication"
    

To add the custom action data for the Uninstall method

  1. In the Custom Actions editor, expand Uninstall.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /solutionCodeGroupName="MyCompanyName.ExcelApplication" 
    
NoteNote:

Although the custom action does not override the Commit method, the base Windows Installer class provides an implementation. Thus, you must still call the method. However, it does not require any custom action data.

Adding a Custom Action to Update the Location of the Assembly

When you pressed F5 earlier to run your project, the build process edited the application manifest embedded in the workbook to point to the relative path of the assembly. If the workbook and the assembly remain in the same folder after installation, then you do not have to modify the embedded application manifest, and you can ignore this section. However, if you do want to enable the user to move the workbook to a different folder after installation, then you must edit the application manifest to point to the full path of the assembly. This is especially important for Excel template projects and Word template projects because the workbook or document created from a template typically resides in a location that is different from the template location.

A sample custom action has been created for you. Add this custom action to the Setup project.

To add the custom action project to the solution

  1. Using Windows Explorer, copy the UpdateManifest project from the {SamplesDir}\projects directory to the directory containing the ExcelApplication Solution.

  2. In Solution Explorer, right-click the ExcelApplication node.

  3. Point to Add on the shortcut menu, and then click Existing Project.

  4. Select the UpdateManifest project.

  5. Click OK.

  6. In Solution Explorer, right-click the UpdateManifest project, and then click Build.

  7. Add the primary output of the UpdateManifest project to the Setup project.

    This enables the Windows Installer file to run the custom action that edits the application manifest.

To add the primary output of the custom action project to the Setup project

  1. In Solution Explorer, right-click the ExcelApplicationSetup node.

  2. Point to View on the shortcut menu, and then click Custom Actions.

  3. In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.

  4. In the Look In list, click Application Folder, and then click Add Output.

    The Add Project Output Group dialog box opens.

  5. In the Project list, click UpdateManifest.

  6. From the list of output types, select Primary output, and then click OK.

  7. Verify that Primary output from UpdateManifest (Active) is in the list of primary outputs for the Setup project, and then click OK.

  8. Add the required custom action data.

NoteNote:

Although the custom action does not override the Commit, Rollback, and Uninstall methods, the base Windows Installer class provides an implementation. Thus, the methods must be called. However, they do not require any custom action data.

To add the custom action data for the Install method

  1. In the Custom Actions editor, expand Install.

  2. Right-click Primary output from UpdateManifest (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /targetDir="[TARGETDIR]/" /documentName="ExcelApplication.xls" /assemblyName="ExcelApplication.dll"
    

Adding Launch Conditions to the .msi File

Recall that when the user runs Setup.exe, Windows Installer checks for the prerequisites and installs them if necessary. Alternatively, the user can double-click the .msi file to install the solution. In that case, the prerequisites are not installed and the solution cannot run. In other cases, Setup might fail because resources it needs are not present; for example, custom actions might require the .NET Framework.

This section shows you how to use the Launch Conditions editor to add launch conditions to the .msi file to prevent installation, if certain dependencies are not installed.

To view the Launch Conditions editor

  1. In Solution Explorer, right-click the ExcelApplicationSetup node.

  2. Point to View on the shortcut menu, and then click Launch Conditions.

  3. Add a launch condition for the Visual Studio 2005 Tools for Office Runtime.

To add a launch condition for the Visual Studio 2005 Tools for Office Runtime

  1. In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for VSTO Runtime.

  4. In the Properties window, type {D2AC2FF1-6F93-40D1-8C0F-0E135956A2DA} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_VSTOR.

  6. Select the newly added launch condition, (Condition1), and then rename it to Display message if the Visual Studio 2005 Tools for Office Runtime is not installed.

  7. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOR.

  8. Leave the InstallURL property blank.

  9. Change the value of the Message property to The Visual Studio 2005 Tools for Office Runtime is not installed. Please run Setup.exe.

If any users run your solutions with non–English settings for Windows, they must have the Visual Studio 2005 Tools for Office Language Pack to see runtime messages in the same language as Windows. Add a launch condition to check for the Language Pack.

To add a launch condition for the Visual Studio 2005 Tools for Office Language Pack

  1. In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for VSTO Language Pack.

  4. In the Properties window, type {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_VSTOLP.

  6. If the Visual Studio 2005 Tools for Office Language Pack is not installed, select the newly added launch condition, (Condition 1), and rename it to Display message.

  7. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOLP.

  8. Leave the InstallURL property blank.

  9. Change the value of the Message property to The Visual Studio 2005 Tools for Office Language Pack is not installed. Please run Setup.exe.

  10. Follow these instructions to add a launch condition for the Excel, Outlook, Word, and Smart Tag primary interop assemblies.

NoteTip:

In practice, your solution may require a different set of primary interop assemblies. For example, the Excel solution deployed in this walkthrough only requires the Excel 2003 primary interop assemblies. You can modify the following instructions to add or remove checks for individual primary interop assemblies as required.

When you create the launch conditions for the Visual Studio 2005 Tools for Office Runtime and the Visual Studio 2005 Tools for Office Language Pack, you must right-click the Requirements on Target Machine node. This creates both the search condition and the corresponding launch condition.

To create a launch condition to search for four primary interop assemblies, you must create four separate search conditions (one for each primary interop assembly), and then one launch condition that logically combines the four search conditions.

To add a search condition for the Excel 2003 primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Excel 2003 PIA.

  4. In the Properties window, type {A1FE0698-609D-400F-BF10-F52238DD6475} into the ComponentId property.

  5. In the Properties window, change the value of Property to COMPONENTEXISTS_EXCEL_PIA.

To add a search condition for the Outlook 2003 primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Outlook 2003 PIA.

  4. In the Properties window, type {14D3E42A-A318-4D77-9895-A7EE585EFC3B} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_OUTLOOK_PIA.

To add a search condition for the Word 2003 primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Word 2003 PIA.

  4. In the Properties window, type {1C8772BD-6E6F-4C9D-8FF8-B5EA072F86EF} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_WORD_PIA.

To add a search condition for the Smart Tag primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Smart Tag PIA.

  4. In the Properties window, type {53C65973-D89D-4EA0-8567-8788C14E0A02} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_SMART_TAG_PIA.

To create a launch condition for the primary interop assemblies

  1. In the Launch Conditions editor, right-click Launch Conditions, and then select Add Launch Condition.

  2. Select the newly added launch condition, (Condition1).

  3. Rename it to Display message if the Primary Interop Assemblies are not installed.

  4. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_EXCEL_PIA AND COMPONENTEXISTS_OUTLOOK_PIA AND COMPONENTEXISTS_WORD_PIA AND COMPONENTEXISTS_SMART_TAG_PIA.

  5. In the Properties window, leave the InstallURL property blank.

  6. Change the value of the Message property to The Office 2003 Primary Interop Assemblies have not been installed Please run setup.exe.

Testing the Installation

To test your Windows Installer, you must run it on a computer other than your development computer, because many of the prerequisites are already installed. Run the Setup.exe file to test the bootstrapper, but first to build your Setup project.

To build the project

  • In Solution Explorer, right-click the ExcelApplicationSetup project, and then click Build.

Walkthrough: Enhancing the Outlook Add-in Setup Project

This section describes how to enhance the Setup project that is created when you create an Outlook add-in project. You learn how to:

  • Modify the Setup project so that it installs the prerequisites: the Visual Studio 2005 Tools for Office Runtime, (optionally) the Visual Studio 2005 Tools for Office Language Pack, and the Office primary interop assemblies.

  • Add a step to the Setup project to grant security trust to the customization assembly.

  • Add launch conditions to the .msi file to prevent installation if the prerequisites are not installed.

Creating the Project

In this step, you create an Outlook add-in project in Visual C#.

To create a new project

  1. Create an Outlook add-in project in Visual C# with the name OutlookAddin.

  2. Verify that Create a new document is selected.

    Visual Studio opens the new Outlook add-in in the designer and adds the OutlookAddin project to Solution Explorer.

Signing the Assembly

Later in this article, you grant trust to the customization assembly based upon a strong name and its location. However, you must first sign the assembly.

To sign the assembly

  1. In Solution Explorer, right-click the OutlookAddin node, and then click Properties.

  2. Click the Signing tab.

  3. Select the Sign the assembly check box.

  4. In the Choose a strong name key file list, click <New. . .>.

  5. Type the name OutlookAddin into the Key file name box.

  6. Type a password into the Enter password and Confirm password boxes.

  7. Click OK.

  8. Close the Properties pages.

Adding Code to the Add-in

In this step, you add a message box to the Microsoft.Office.Tools.Outlook.Application.Startup event handler of the Outlook add-in. This enables you to verify that the solution is working when you start Outlook.

To add a message box to an initialization event

  1. In Solution Explorer, right-click ThisApplication.cs, and then click View Code.

  2. Add the following code to the ThisApplication_Startup event handler inside the ThisApplication class to show a message box during initialization.

      private void ThisApplication_Startup(object sender,
                System.EventArgs e)
      {
       MessageBox.Show(
          "The Outlook add-in has been deployed successfully.");
      }
    
  3. Press F5 to run the project.

    Outlook starts and the message box appears.

  4. Close the message box.

  5. Exit Outlook.

Adding the Prerequisites to the Setup Project

This step relies on you having prepared the development environment.

Add the prerequisites that are installed by the bootstrapper. A later step addresses adding launch conditions.

To add the prerequisites

  1. In Solution Explorer, right-click the OutlookAddinSetup node, and then click Properties.

  2. In the Property Pages dialog box, click the Prerequisites button.

  3. In the list of prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio 2005 Tools for Office Runtime.

  4. Select Microsoft Visual Studio 2005 Tools for Office Runtime Language Pack if any users run your solutions with non–English settings for Windows. These users must have the Visual Studio 2005 Tools for Office Language Pack to see runtime messages in the same language as Windows.

  5. Click OK twice.

Adding a Custom Action to Grant Trust to the Assembly

Grant trust to the customization assembly using the supplied custom action sample.

To add the supplied project

  1. Using Windows Explorer, copy the SetSecurity project from the {SamplesDir}\projects directory to the directory containing the OutlookAddin Solution.

    NoteTip:

    By default, the SamplesDir directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office Resources\VSTO2005 Windows Installer Sample

  2. In Solution Explorer, right-click the OutlookAddin node.

  3. Point to Add on the shortcut menu, and then click Existing Project.

  4. Select the SetSecurity project.

  5. Click OK.

  6. In Solution Explorer, right-click the SetSecurity project, and then click Build.

  7. Add the primary output of the SetSecurity project to the Setup project.

    This enables the Windows Installer file to run the custom action that edits the application manifest.

To add the primary output of the custom action project to the Setup project

  1. In Solution Explorer, right-click the OutlookAddinSetup node.

  2. Point to View on the shortcut menu, and then click Custom Actions.

  3. In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.

  4. In the Look In list, click Application Folder, and then click Add Output.

    The Add Project Output Group dialog box opens.

  5. Click SetSecurity in the Project list.

  6. Select Primary output from the list of output types, and then click OK.

  7. Verify that Primary output from SetSecurity (Active) is added to the list of primary outputs for the Setup project, and then click OK.

  8. Add the required custom action data.

To add the custom action data for the Install method

  1. In the Custom Actions editor, expand Install.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /assemblyName="OutlookAddin.dll" /targetDir="[TARGETDIR]\" 
       /solutionCodeGroupName="MyCompanyName.OutlookAddin" 
       /solutionCodeGroupDescription="Code group for OutlookAddin" 
       /assemblyCodeGroupName="OutlookAddin" 
       /assemblyCodeGroupDescription="Code group for OutlookAddin" 
       /allUsers=[ALLUSERS]
       
    

To add the custom action data for the Rollback method

  1. In the Custom Actions editor, expand Rollback.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /solutionCodeGroupName="MyCompanyName.OutlookAddin" 
    

To add the custom action data for the Uninstall method

  1. In the Custom Actions editor, expand Uninstall.

  2. Right-click Primary output from SetSecurity (Active), and then click Properties Window.

  3. In the Properties window, set the CustomActionData property to the following string:

    /solutionCodeGroupName="MyCompanyName.OutlookAddin"
    
NoteNote:

Although the Commit method was not overridden by the custom action, the base Windows Installer class provides an implementation. Thus, you must still call the method. However, it does not require any custom action data.

Adding Launch Conditions to the .msi File

Recall that when the user runs Setup.exe, the Windows Installer checks for the prerequisites, and installs them if necessary. Alternatively, the user can double-click the .msi file to install the solution. In that case, the prerequisites are not installed and the solution cannot run. In other cases, Setup might fail because resources it needs are not present; for example, custom actions might require the .NET Framework.

This section shows you how to use the Launch Conditions editor to add launch conditions to the .msi file to prevent installation if certain dependencies are not installed.

To view the Launch Conditions editor

  1. In Solution Explorer, right-click the OutlookAddinSetup node.

  2. Point to View on the shortcut menu, and then click Launch Conditions.

Add a launch condition for the Visual Studio 2005 Tools for Office Runtime.

To add a launch condition for the Visual Studio 2005 Tools for Office Runtime

  1. In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for VSTO Runtime.

  4. In the Properties window, type {D2AC2FF1-6F93-40D1-8C0F-0E135956A2DA} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_VSTOR.

  6. Select the newly added launch condition, (Condition1).

  7. Rename it to Display message, if the Visual Studio 2005 Tools for Office Runtime is not installed.

  8. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOR.

  9. Leave the InstallURL property blank.

  10. Change the value of the Message property to The Visual Studio 2005 Tools for Office Runtime is not installed. Please run Setup.exe.

If any users run your solutions with non–English settings for Windows, they must have the Visual Studio 2005 Tools for Office Language Pack to see runtime messages in the same language as Windows. Add a launch condition to check for the Language Pack.

To add a launch condition for the Visual Studio 2005 Tools for Office Language Pack

  1. In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for VSTO Language Pack.

  4. In the Properties window, type {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_VSTOLP.

  6. Select the newly added launch condition, (Condition1).

  7. Rename it to Display message if the Visual Studio 2005 Tools for Office Language Pack is not installed.

  8. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOLP.

  9. Leave the InstallURL property blank.

  10. Change the value of the Message property to The Visual Studio 2005 Tools for Office Language Pack is not installed. Please run Setup.exe.

Follow these instructions to add a launch condition for the Excel, Outlook, Word, and Smart Tag primary interop assemblies.

NoteTip:

In practice, your solution may require a different set of primary interop assemblies. For example, the Excel solution deployed in this walkthrough only requires the Outlook 2003 primary interop assemblies. You can modify the following instructions to add or remove checks for individual primary interop assemblies as required.

When you create the launch conditions for the Visual Studio 2005 Tools for Office Runtime and the Visual Studio 2005 Tools for Office Language Pack, you must right-click the Requirements on Target Machine node. This created both the search condition and the corresponding launch condition.

To create a launch condition to search for four primary interop assemblies, you must create four separate search conditions (one for each primary interop assembly) and then one launch condition that logically combines the four search conditions.

To add a search condition for the Excel 2003 primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Excel 2003 PIA.

  4. In the Properties window, type {A1FE0698-609D-400F-BF10-F52238DD6475} into the ComponentId property.

  5. In the Properties window, change the value of Property to COMPONENTEXISTS_EXCEL_PIA.

To add a search condition for the Outlook 2003 primary interop assembly

  1. In the Launch Conditions editor right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Outlook 2003 PIA.

  4. In the Properties window, type {14D3E42A-A318-4D77-9895-A7EE585EFC3B} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_OUTLOOK_PIA.

To add a search condition for the Word 2003 primary interop assembly

  1. In the Launch Conditions editor, right-click Search Target Machine, and select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Word 2003 PIA.

  4. In the Properties window, type {1C8772BD-6E6F-4C9D-8FF8-B5EA072F86EF} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_WORD_PIA.

To add a search condition for the Smart Tag primary interop assembly

  1. In the Launch Conditions editor right-click Search Target Machine, and then select Add Windows Installer Search.

  2. Select the newly added search condition, Search for Component1.

  3. Rename the search condition to Search for Smart Tag PIA.

  4. In the Properties window, type {53C65973-D89D-4EA0-8567-8788C14E0A02} into the ComponentId property.

  5. Change the value of Property to COMPONENTEXISTS_SMART_TAG_PIA.

To create a launch condition for the primary interop assemblies

  1. In the Launch Conditions editor right-click Launch Conditions, and then select Add Launch Condition.

  2. Select the newly added launch condition, (Condition1).

  3. Rename it to Display message if the Primary Interop Assemblies are not installed.

  4. In the Properties window, change the value of the Condition property to COMPONENTEXISTS_EXCEL_PIA AND COMPONENTEXISTS_OUTLOOK_PIA AND COMPONENTEXISTS_WORD_PIA AND COMPONENTEXISTS_SMART_TAG_PIA.

  5. In the Properties window, leave the InstallURL property blank.

  6. Change the value of the Message property to The Office 2003 Primary Interop Assemblies have not been installed Please run setup.exe.

Testing the Installation

To test your Windows Installer, you must run it on a computer other than your development computer, because many of the prerequisites are already installed. Remember to run the Setup.exe file to test the bootstrapper. Remember first to build your Setup project.

To build Setup

  • In Solution Explorer, right-click the OutlookAddinSetup project, and then click Build.

Conclusion

This article demonstrates how to deploy a Visual Studio 2005 Tools for Office solution using a Visual Studio Setup project to create a Windows Installer package. The walkthroughs demonstrate how you may install the required prerequisites, grant trust to a customization assembly, and update the location of a customization assembly for a document.

For an overview of the deployment process, see Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer (Part 1 of 2).

Additional Resources

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.