Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer: Walkthroughs (Part 2 of 2)
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
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
Walkthrough: Creating Windows Installer Packages to Deploy Visual Studio 2005 Tools for Office Solutions
Walkthrough: Enhancing the Outlook Add-in Setup Project
Conclusion
Additional Resources
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.
Important
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
Create an Excel Workbook project in Visual C# with the name ExcelApplication.
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
In Solution Explorer, right-click the ExcelApplication node, and then click Properties.
Click the Signing tab.
Select the Sign the assembly check box.
In the Choose a strong name key file list, click <New. . .>.
Type ExcelApplication into the Key file name box.
Type a password into the Enter password and Confirm password boxes.
Click OK.
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
In Solution Explorer, right-click ThisWorkbook.cs, and then click View Code.
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."); }
Press F5 to run the project.
Excel starts and the message box appears.
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
In Solution Explorer, right-click the Solution node.
Point to Add on the shortcut menu, and then click New Project.
The Add New Project dialog box appears.
In the Project Types pane, expand Other Project types, and then select Setup and Deployment.
In the Templates pane, select Setup project.
Name the project ExcelApplicationSetup.
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
In Solution Explorer, right-click the ExcelApplicationSetup node.
Point to View on the shortcut menu, and then click File System.
Right-click Application Folder in the left pane.
Point to Add on the shortcut menu, and then click Project Output.
In the Project box, select ExcelApplication.
In the list of output types, select Primary output.
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
In Solution Explorer, expand Detected Dependencies under the ExcelApplicationSetup node.
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.
Important
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
In Solution Explorer, right-click the ExcelApplicationSetup node.
Click Properties.
In the Property Pages dialog box, click the Prerequisites button.
In the list of prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio Tools for Office Runtime.
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.
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
Using Windows Explorer, copy the SetSecurity project from the {SamplesDir}\projects directory to the directory containing the ExcelApplication Solution.
Tip
By default, the SamplesDir directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office Resources\VSTO2005 Windows Installer Sample
In Solution Explorer, right-click the ExcelApplication node.
Point to Add on the shortcut menu, and then click Existing Project.
Select the SetSecurity project.
Click OK.
In Solution Explorer, right-click the SetSecurity project, and then click Build.
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
In Solution Explorer, right-click the ExcelApplicationSetup node.
Point to View on the shortcut menu, and then click Custom Actions.
In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.
In the Look In list, click Application Folder, and then click Add Output.
The Add Project Output Group dialog box opens.
Click SetSecurity in the Project list.
In the list of output types, select Primary output, and then click OK.
Verify that Primary output from SetSecurity (Active) is in the list of primary outputs for the Setup project, and then click OK.
Add the required custom action data.
To add the custom action data for the Install method
In the Custom Actionseditor, expand Install.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
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
In the Custom Actions editor, expand Rollback.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
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
In the Custom Actions editor, expand Uninstall.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
In the Properties window, set the CustomActionData property to the following string:
/solutionCodeGroupName="MyCompanyName.ExcelApplication"
Note
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
Using Windows Explorer, copy the UpdateManifest project from the {SamplesDir}\projects directory to the directory containing the ExcelApplication Solution.
In Solution Explorer, right-click the ExcelApplication node.
Point to Add on the shortcut menu, and then click Existing Project.
Select the UpdateManifest project.
Click OK.
In Solution Explorer, right-click the UpdateManifest project, and then click Build.
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
In Solution Explorer, right-click the ExcelApplicationSetup node.
Point to View on the shortcut menu, and then click Custom Actions.
In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.
In the Look In list, click Application Folder, and then click Add Output.
The Add Project Output Group dialog box opens.
In the Project list, click UpdateManifest.
From the list of output types, select Primary output, and then click OK.
Verify that Primary output from UpdateManifest (Active) is in the list of primary outputs for the Setup project, and then click OK.
Add the required custom action data.
Note
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
In the Custom Actions editor, expand Install.
Right-click Primary output from UpdateManifest (Active), and then click Properties Window.
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
In Solution Explorer, right-click the ExcelApplicationSetup node.
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
In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for VSTO Runtime.
In the Properties window, type {D2AC2FF1-6F93-40D1-8C0F-0E135956A2DA} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_VSTOR.
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.
In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOR.
Leave the InstallURL property blank.
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
In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for VSTO Language Pack.
In the Properties window, type {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_VSTOLP.
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.
In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOLP.
Leave the InstallURL property blank.
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.
Tip
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
In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Excel 2003 PIA.
In the Properties window, type {A1FE0698-609D-400F-BF10-F52238DD6475} into the ComponentId property.
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
In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Outlook 2003 PIA.
In the Properties window, type {14D3E42A-A318-4D77-9895-A7EE585EFC3B} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_OUTLOOK_PIA.
To add a search condition for the Word 2003 primary interop assembly
In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Word 2003 PIA.
In the Properties window, type {1C8772BD-6E6F-4C9D-8FF8-B5EA072F86EF} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_WORD_PIA.
To add a search condition for the Smart Tag primary interop assembly
In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Smart Tag PIA.
In the Properties window, type {53C65973-D89D-4EA0-8567-8788C14E0A02} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_SMART_TAG_PIA.
To create a launch condition for the primary interop assemblies
In the Launch Conditions editor, right-click Launch Conditions, and then select Add Launch Condition.
Select the newly added launch condition, (Condition1).
Rename it to Display message if the Primary Interop Assemblies are not installed.
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.
In the Properties window, leave the InstallURL property blank.
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
Create an Outlook add-in project in Visual C# with the name OutlookAddin.
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
In Solution Explorer, right-click the OutlookAddin node, and then click Properties.
Click the Signing tab.
Select the Sign the assembly check box.
In the Choose a strong name key file list, click <New. . .>.
Type the name OutlookAddin into the Key file name box.
Type a password into the Enter password and Confirm password boxes.
Click OK.
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
In Solution Explorer, right-click ThisApplication.cs, and then click View Code.
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."); }
Press F5 to run the project.
Outlook starts and the message box appears.
Close the message box.
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
In Solution Explorer, right-click the OutlookAddinSetup node, and then click Properties.
In the Property Pages dialog box, click the Prerequisites button.
In the list of prerequisites, select Microsoft Office 2003 Primary Interop Assemblies and Microsoft Visual Studio 2005 Tools for Office Runtime.
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.
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
Using Windows Explorer, copy the SetSecurity project from the {SamplesDir}\projects directory to the directory containing the OutlookAddin Solution.
Tip
By default, the SamplesDir directory is C:\Program Files\Microsoft Visual Studio 2005 Tools for Office Resources\VSTO2005 Windows Installer Sample
In Solution Explorer, right-click the OutlookAddin node.
Point to Add on the shortcut menu, and then click Existing Project.
Select the SetSecurity project.
Click OK.
In Solution Explorer, right-click the SetSecurity project, and then click Build.
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
In Solution Explorer, right-click the OutlookAddinSetup node.
Point to View on the shortcut menu, and then click Custom Actions.
In the Custom Actions editor, right-click the Custom Actions node, and then click Add Custom Action.
In the Look In list, click Application Folder, and then click Add Output.
The Add Project Output Group dialog box opens.
Click SetSecurity in the Project list.
Select Primary output from the list of output types, and then click OK.
Verify that Primary output from SetSecurity (Active) is added to the list of primary outputs for the Setup project, and then click OK.
Add the required custom action data.
To add the custom action data for the Install method
In the Custom Actions editor, expand Install.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
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
In the Custom Actions editor, expand Rollback.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
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
In the Custom Actions editor, expand Uninstall.
Right-click Primary output from SetSecurity (Active), and then click Properties Window.
In the Properties window, set the CustomActionData property to the following string:
/solutionCodeGroupName="MyCompanyName.OutlookAddin"
Note
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
In Solution Explorer, right-click the OutlookAddinSetup node.
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
In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for VSTO Runtime.
In the Properties window, type {D2AC2FF1-6F93-40D1-8C0F-0E135956A2DA} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_VSTOR.
Select the newly added launch condition, (Condition1).
Rename it to Display message, if the Visual Studio 2005 Tools for Office Runtime is not installed.
In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOR.
Leave the InstallURL property blank.
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
In the Launch Conditions editor, right-click Requirements on Target Machine, and then click Add Windows Installer Launch Condition.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for VSTO Language Pack.
In the Properties window, type {2E3A394E-C9BD-40C3-9990-BA7AF7C8B4AF} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_VSTOLP.
Select the newly added launch condition, (Condition1).
Rename it to Display message if the Visual Studio 2005 Tools for Office Language Pack is not installed.
In the Properties window, change the value of the Condition property to COMPONENTEXISTS_VSTOLP.
Leave the InstallURL property blank.
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.
Tip
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
In the Launch Conditions editor, right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Excel 2003 PIA.
In the Properties window, type {A1FE0698-609D-400F-BF10-F52238DD6475} into the ComponentId property.
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
In the Launch Conditions editor right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Outlook 2003 PIA.
In the Properties window, type {14D3E42A-A318-4D77-9895-A7EE585EFC3B} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_OUTLOOK_PIA.
To add a search condition for the Word 2003 primary interop assembly
In the Launch Conditions editor, right-click Search Target Machine, and select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Word 2003 PIA.
In the Properties window, type {1C8772BD-6E6F-4C9D-8FF8-B5EA072F86EF} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_WORD_PIA.
To add a search condition for the Smart Tag primary interop assembly
In the Launch Conditions editor right-click Search Target Machine, and then select Add Windows Installer Search.
Select the newly added search condition, Search for Component1.
Rename the search condition to Search for Smart Tag PIA.
In the Properties window, type {53C65973-D89D-4EA0-8567-8788C14E0A02} into the ComponentId property.
Change the value of Property to COMPONENTEXISTS_SMART_TAG_PIA.
To create a launch condition for the primary interop assemblies
In the Launch Conditions editor right-click Launch Conditions, and then select Add Launch Condition.
Select the newly added launch condition, (Condition1).
Rename it to Display message if the Primary Interop Assemblies are not installed.
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.
In the Properties window, leave the InstallURL property blank.
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
Deploying Visual Studio 2005 Tools for Office Solutions Using Windows Installer (Part 1 of 2)
Microsoft Office Developer Center: Visual Studio Tools for Office Developer Portal
Microsoft Visual Studio 2005 Tools for the Microsoft Office System blog
Code Security
Redistributable Packages