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

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

Darryn Lavery, Microsoft Corporation

Lubo Birov, Microsoft Corporation

McLean Schofield, Microsoft Corporation

Brian A. Randell, MCW Technologies, LLC

Published March 2007

Updated December 2007

Applies to: Microsoft Visual Studio 2008, 2007 Microsoft Office System, Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System, Microsoft Visual Studio 2005, Microsoft Visual Studio 2005 Tools for the Microsoft Office System, Microsoft Office 2003

Download Visual Studio 2005 Tools for Office Second Edition Sample: Deploying Office Solutions Using Windows Installer Version 3

Contents

  • Overview

  • Walkthrough: Enhancing the Outlook Add-in Setup Project

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

  • Conclusion

  • Additional Resources

Overview

This article, the second of two, provides two walkthroughs that show how to deploy a Microsoft Visual Studio 2005 Tools for the 2007 Microsoft Office System (Visual Studio 2005 Tools for Office Second Edition, or VSTO 2005 SE) solution using a Visual Studio Setup project to create a Windows Installer package. These walkthroughs also apply to Microsoft Office 2003 projects that are created in Microsoft Visual Studio 2008.

NoteNote

These walkthroughs do not apply to projects in Visual Studio 2008 that are based on applications in the 2007 Microsoft Office system, which use ClickOnce deployment technology instead.

The first walkthrough demonstrates how to enhance a Microsoft Office Outlook 2003 or 2007 add-in created by using VSTO 2005 SE to include installing the prerequisites and granting trust to the customization assembly. The instructions provided here apply to all types of add-ins that you can create with VSTO 2005 SE for the 2003 or 2007 releases of Office.

The second walkthrough provides end-to-end steps to create a Windows Installer package for a Microsoft Office Excel 2003 or Microsoft Office Word 2003 solution. VSTO 2005 SE adds support for application-level add-ins for the 2003 and 2007 releases of Microsoft Office. It does not provide any new support for creating document solutions for the 2007 release. However, your Office 2003 document solutions will run in Microsoft Office Word 2007 or Microsoft Office Excel 2007.

Important noteImportant

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

Walkthrough: Enhancing the Outlook Add-in Setup Project

This section describes how to enhance the Setup project that Visual Studio defines when you create an Outlook add-in project. It explains how to perform the following steps:

  • Modify the Setup project so that it installs the prerequisites: the VSTO 2005 SE runtime and, optionally, the Visual Studio 2005 Tools for Office Language Pack.

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

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

Creating the Project

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

NoteNote

The instructions provided here apply to all supported VSTO 2005 SE host applications, not just Outlook 2003.

To create a new Outlook 2003 add-in project

  1. In Visual Studio, on the File menu, click New Project.

  2. In the New Project dialog box, in Project types, expand Visual C#, expand Office, and then select 2003 Add-ins.

  3. In the Templates list, select Outlook Add-in.

  4. In the Name box, type OutlookAddin.

  5. Ensure Create directory for solution is checked, and click OK.

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

Signing the Assembly

Later in this article, you will 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 OutlookAddin, 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 in the Key file name box.

  6. Type a password in 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 ThisAddIn_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 ThisAddIn.cs, and then click View Code.

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

    private void ThisAddin_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

Add the prerequisites that the bootstrapper will install. A later step addresses adding launch conditions.

To add the prerequisites

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

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

  3. In the list of prerequisites, select the following items:

    1. Microsoft Office 2003 Primary Interop Assemblies

    2. 2007 Microsoft Office Primary Interop Assemblies

    3. Microsoft Visual Studio 2005 Tools for Office SE 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 that contains the OutlookAddin solution.

    Tip

    By default, the {SamplesDir} directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\

  2. In Solution Explorer, right-click OutlookAddin.

  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.

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

  1. In Solution Explorer, right-click OutlookAddinSetup.

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

  3. In the Custom Actions editor, right-click Custom Actions, 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 SetSecurity.

  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.

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

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. Enter this as one long string, and change MyCompanyName to your company name.

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

You do not need to add extra quotation marks if your company name contains a space.

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 you did not override the Commit method with a 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 Windows Installer File

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 OutlookAddinSetup.

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

Add a launch condition for the VSTO 2005 SE runtime.

To add a launch condition for the VSTO 2005 SE runtime

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

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

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

  4. In the Properties window, change the value of Property to VSTORTVERSION.

  5. Also in the Properties window, set the value of RegKey to the following string.

    Software\Microsoft\vsto runtime Setup\v2.0.50727
    
  6. Leave the Root property set to vsdrrHKLM and change the Value property to Update.

  7. Select the newly added launch condition, Condition1.

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

  9. In the Properties window, change the value of the Condition property to the following string.

    VSTORTVERSION >= "#3"
    
  10. Leave the InstallURL property blank.

  11. Change the value of the Message property to The Visual Studio 2005 Tools for Office SE 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, in the ComponentId property, type the following GUID:

    {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF}

  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.

When you create the launch conditions for the VSTO 2005 SE 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.

Testing the Installation

To test your Windows Installer, 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.

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

This section describes how to create a Windows Installer package for Excel or Word document-based solutions. Although the example shows you how to deploy an Excel solution, you can use the same steps to deploy a Word solution. To perform this walkthrough, your development computer needs to have Office 2003 installed with VSTO 2005 SE. However, you can install the solution on a computer that has Office 2007 installed.

This walkthrough shows how to perform the following steps:

  • 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 VSTO 2005 SE solution.

  • Add the prerequisites.

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

  • Add a custom action to edit the application manifest that is embedded in the solution document.

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 you have selected Create a new document.

    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 on a strong name and the assembly location. Before you can grant trust, you must sign the assembly.

To sign the assembly

  1. In Solution Explorer, right-click ExcelApplication, 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 in the Key file name box.

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

  7. Click OK.

  8. Close the Properties page.

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 Solution, point to Add, and then click New Project.

    The Add New Project dialog box appears.

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

  3. In the Templates pane, select Setup project.

  4. Name the project ExcelApplicationSetup.

  5. Click OK.

The Setup project appears in Solution Explorer. By default, the Windows Installer file that you build by 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 ExcelApplicationSetup.

  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, 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, under the ExcelApplicationSetup node, expand Detected Dependencies.

  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 your development environment as described in Deploying Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer (Part 1 of 2).

There are two ways to start 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.

    Important noteImportant

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

  • An .msi file

    When this executable file launches, the bootstrapper does not execute and the prerequisites are not installed. However, it is possible to add launch conditions that prevent installation when the 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 ExcelApplicationSetup.

  2. Click Properties.

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

  4. In the list of prerequisites, select the following items:

    • Microsoft Office 2003 Primary Interop Assemblies

    • 2007 Microsoft Office Primary Interop Assemblies

    • Microsoft Visual Studio Tools for Office SE 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 Tools for Office solution can run, the customization assembly must have FullTrust permissions. The sample custom action included in the source code that accompanies 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 that contains the ExcelApplication solution.

    Tip

    By default, the {SamplesDir} directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\

  2. In Solution Explorer, right-click ExcelApplication.

  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.

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

  1. In Solution Explorer, right-click ExcelApplicationSetup.

  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 SetSecurity.

  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.

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. Enter this as one long string, and change MyCompanyName to your company name.

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

You do not need to add extra quotation marks if your company name contains a space.

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 that contains the ExcelApplication solution.

  2. In Solution Explorer, right-click ExcelApplication.

  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 ExcelApplicationSetup.

  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. In 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. Enter this as one long string.

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

Adding Launch Conditions to the .msi File

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 when certain dependencies are not installed.

To view the Launch Conditions editor

  1. In Solution Explorer, right-click ExcelApplicationSetup.

  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 VSTO 2005 SE runtime

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

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

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

  4. In the Properties window, change the value of Property to VSTORTVERSION.

  5. Also in the Properties window, set the value of RegKey to the following string:

    Software\Microsoft\vsto runtime Setup\v2.0.50727

  6. Leave the Root property set to vsdrrHKLM.

  7. Change the Value property to Update.

  8. Select the newly added launch condition, Condition1.

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

  10. In the Properties window, change the value of the Condition property to the following:

    VSTORTVERSION >= "#3"

  11. Leave the InstallURL property blank.

  12. Change the value of the Message property to The Visual Studio 2005 Tools for Office SE 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, in the ComponentId property, type the following GUID:

    {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF}

  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.

Testing the Installation

To test your Windows Installer, run it on a computer other than your development computer, because many of the prerequisites are already installed. Build your Setup project, and then run the Setup.exe file to test the bootstrapper.

To build the project

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

Conclusion

This article demonstrates how to deploy Microsoft Office solutions using a Visual Studio Setup project to create a Windows Installer package. The walkthroughs demonstrate how you can 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 the Office System SE Solutions Using Windows Installer (Part 1 of 2).

Additional Resources

Code Security

Redistributable Packages