This documentation is archived and is not being maintained.

Deploying Multiple Office 2010 Projects in One Package

Office 2010

Office Visual How To

Summary:  Learn how to deploy Office solutions by using ClickOnce deployment. When you publish solutions, you create the ClickOnce files, including setup routines. By using multiple solutions, you have multiple setup routines. This article describes how to combine multiple setup routines so that users can install all the solutions at the same time.

Last modified: September 12, 2012

Applies to: Excel 2010 | Office 2010 | Open XML | PowerPoint 2010 | VBA | Word 2010

Published:  August 2010

Provided by:  Robert Green, MVP, MCW Technologies

Overview

Scenario: You created two or more Microsoft Office 2010 solutions using Microsoft Visual Studio 2010. You tested the solutions on your computer and now you want to deploy them to users. You can use ClickOnce to deploy the solutions, but you have to publish each of them individually. This requires that users install them separately. You want to deploy the solutions as a single package so that users only have to run one setup routine. The Visual Studio Tools for Office runtime can deploy multiple Office solutions in a single ClickOnce install.

ClickOnce uses an application manifest to determine what to install and how to install it. Each solution that you publish has an application manifest. Visual Studio cannot create a multi-solution application manifest. You can do this manually. This article describes how to create a multi-solution application manifest and install multiple Office solutions with one Setup routine. For more information about how to deploy Office solutions using ClickOnce, see the links in the Explore It section.

Code It

Follow these steps to create a multi-solution application manifest.

To review the solutions

  1. In Visual Studio 2010, load the original sample project, DeployMultipleOfficeSolutions.sln.

    Figure 1. Sample solution contains three projects

    Sample solution containg three projects
  2. The ExcelSmartTagAddIn project is an Microsoft Excel 2010 application-level add-in that provides a custom smart tag which recognizes temperatures in Fahrenheit or Celsius, and offers the option to convert to the other scale, shown in Figure 2. The Ribbon customization, shown in Figure 3, enables users to enter a temperature value, set its scale, and then insert the temperature into the workbook. You may find the internal code for the add-in to be of interest, but it's not the focus of this article. Instead, this article focuses on deploying multiple Office solutions using a single Setup package.

    Figure 2. Smart tag helps convert temperatures from one scale to another

    Smart tag converter in Excel

    Figure 3. Ribbon customization enables users to insert a formatted temperature value

    Smart tag converter in Word
  3. The WordSmartTagAddIn project is a Word application-level add-in that provides that same features as the Excel add-in.

  4. The MultiSolutionAddInInstaller project is an Excel application-level add-in that contains no code. After publishing this project, you modify the application manifest so that it contains instructions on how to install the other two projects. When users run the Setup routine for this project, the Excel and Word SmartTag add-ins are installed.

Publishing the Solutions

In this section, you publish the three projects. For reasons that you will see shortly, you must publish the MultiSolutionAddInInstaller project last.

To publish the solutions

  1. In the Solution Explorer window, select the ExcelSmartTagAddIn project.

  2. On the Build menu, select Publish ExcelSmartTagAddIn. The Publish Wizard is displayed.

    Figure 4. Use the Publish Wizard to publish an Office solution

    Publish Wizard
  3. Type the location where you want to publish the application.

  4. Click Finish to publish the solution and close the Publish Wizard.

  5. In the Solution Explorer window, select the WordSmartTagAddIn project.

  6. On the Build menu, select Publish WordSmartTagAddIn. The Publish Wizard is displayed.

  7. Type the same location where you want to publish the application.

  8. Click Finish to publish the solution and close the Publish Wizard.

  9. In the Solution Explorer window, select the MultiSolutionAddInInstaller project.

  10. On the Build menu, select Publish MultiSolutionAddInInstaller. The Publish Wizard is displayed.

  11. Type the same location where you want to publish the application.

  12. Click Finish to publish the solution and close the Publish Wizard.

  13. In the Windows Explorer, navigate to the publish folder.

    Figure 5. Contents of the publish folder

    Publish folder contents

    The publish folder contains the deployment manifest files (.vsto files) for the three add-in solutions and a Setup program. The deployment manifest describe how each application is deployed. They include the location of the application manifest files, and the version of the application that clients should run. Each time that you published a project, Visual Studio created a Setup.exe file in this folder. Because you published the MultiSolutionAddInInstaller project last, Setup.exe is the Setup program for that add-in.

  14. Double-click the Application Files folder. This contains three folders: ExcelSmartTagAddIn_1_0_0_0, MultiSolutionAddInInstaller_1_0_0_0 and WordSmartTagAddIn_1_0_0_0. Each of these folders contains the files that you need to install version 1.0.0.0 of each solution.

  15. Double-click the ExcelSmartTagAddIn_1_0_0_0 folder.

    Figure 6. Contents of the ExcelSmartTagAddIn_1_0_0_0 folder

    Contents of Excel add-in folder

    This folder contains the customization assembly (ExcelSmartTagAddIn.dll.deploy), the deployment manifest (ExcelSmartTagAddIn.vsto), the application manifest (ExcelSmartTagAddIn.dll.manifest) and a dependent assembly (Microsoft.Office.Tools.Common.v4.0.Utilities.dll.deploy).

  16. Navigate to the Application Files\WordSmartTagAddIn_1_0_0_0 folder.

    Figure 7. Contents of the WordSmartTagAddIn_1_0_0_0 folder

    Contents of Word add-in folder

    This folder contains the customization assembly, the deployment manifest files, the application manifest files and two dependent assemblies (Microsoft.Office.Tools.Common.v4.0.Utilities.dll.deploy and Microsoft.Office.Tools.Word.v4.0.Utilities.dll.deploy).

  17. Navigate to the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder.

    Figure 8. Contents of the MultiSolutionAddInInstaller_1_0_0_0 folder

    Contents of multi-solution install folder

    This folder contains the customization assembly, the deployment manifest files, the application manifest files and a dependent assembly. Copy the needed files from the other two application files folders into this folder because this is the folder the setup routine looks for files to install.

  18. Return to the Application Files\ExcelSmartTagAddIn_1_0_0_0 folder.

  19. Select and copy the three files that begin with ExcelSmartTagAddIn.

  20. Paste these files into the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder.

  21. Return to the Application Files\WordSmartTagAddIn_1_0_0_0 folder.

  22. Select and copy the three files that begin with WordSmartTagAddIn and the Microsoft.Office.Tools.Word.v4.0.Utilities.dll.deploy file.

  23. Paste these files into the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder, which now contains the customization and dependent assemblies and the manifests for all three solutions.

    Figure 9. Contents of the MultiSolutionAddInInstaller_1_0_0_0 folder

    Contents of multi-solution install folder

Modifying the Application Manifest

The application manifest files contain the prerequisite and dependent assemblies you need to run an Office solution. It also list the assemblies required by the specific document-level or application-level customization. You have to modify the application manifest of the MultiSolutionAddInInstaller solutions and replace its list of assemblies with the lists from the other two projects' application manifests. After modifying the application manifest, you have to re-sign it. Then you must update and re-sign the deployment manifest.

To modify the application manifest

  1. In Visual Studio, on the File menu, select Open File.

  2. In the Open File dialog box, navigate to the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder in the publish folder.

  3. Select the three .manifest files and then click Open to open the files.

  4. In the MultiSolutionAddInInstaller manifest, scroll down to the prerequisites section and notice that Excel is a prerequisite but Word is not. This is because the MultiSolutionAddInInstaller is an Excel add-in project. Next you add XML that specifies that Word is a prerequisite.

    Figure 10. Excel is a prerequisite but Word is not

    Prerequisites section
  5. In the WordSmartTagAddIn manifest, scroll down to the prerequisites section and copy the XML that specifies that Word is a prerequisite.

    Figure 11. XML code that specifies that Word is a prerequisite

    XML that specifies Word
  6. In the MultiSolutionAddInInstaller manifest, paste this XML after the XML that specifies that Excel is a prerequisite.

  7. In the MultiSolutionAddInInstaller manifest, scroll down to the installation section and notice that it specifies that the installer will install the MultiSolutionAddInInstaller assembly. Next you replace this with the appropriate sections from the other two manifests.

    Figure 12. Install the MultiSolutionAddInInstaller assembly

    Installing the multi-solution assembly
  8. In the ExcelSmartTagAddIn manifest, scroll down to the installation section and copy the XML that instructs the installer to install the Excel add-in.

    Figure 13. XML code that instructs the installer to install the Excel add-in

    Installing the Excel add-in
  9. In the MultiSolutionAddInInstaller manifest, replace the XML that specifies that the MultiSolutionAddInInstaller assembly is installed with the XML you just copied.

  10. In the WordSmartTagAddIn manifest, scroll down to the installation section and copy the XML that instructs the installer to install both the Microsoft.Office.Tools.Word.v4.0.Utilities assembly and the Word add-in.

    Figure 14. XML code that instructs the installer to install the dependent assembly and the Word add-in

    Install the dependent assembly and the Word add-in
  11. In the MultiSolutionAddInInstaller manifest, add the XML you just copied after the XML you just pasted.

  12. In the MultiSolutionAddInInstaller manifest, scroll down to the entry points section and notice that it defines an entry point for the MultiSolutionAddInInstaller assembly. Replace this with the appropriate sections from the other two manifests.

    Figure 15. XML code that defines the entry point for the MultiSolutionAddInInstaller assembly

    Entry point for the assembly
  13. In the ExcelSmartTagAddIn manifest, scroll down to the entry points section and copy the XML that specifies the entry point for the Excel add-in.

    Figure 16. XML code that defines the entry point for the Excel add-in assembly

    Entry point for the Excel add-in assembly
  14. In the MultiSolutionAddInInstaller manifest, replace the XML that specifies that the entry point for the MultiSolutionAddInInstaller assembly with the XML you just copied.

  15. In the WordSmartTagAddIn manifest, scroll down to the entry points section and copy the XML that specifies the entry point for the Word add-in.

    Figure 17. XML that code defines the entry point for the Word add-in assembly

    Entry point for the Word add-in assembly
  16. In the MultiSolutionAddInInstaller manifest, add the XML you just copied after the XML you just pasted.

  17. You now have two entryPoints elements. Add the following XML in bold to uniquely identify them:

    <vstav3:entryPoints id="MultiExcel">
    …
    <vstav3:entryPoints id="MultiWord">
    
  18. In the MultiSolutionAddInInstaller manifest, scroll down to the customizations section and notice that it defines a customization for the MultiSolutionAddInInstaller assembly. Replace this with the appropriate sections from the other two manifests.

    Figure 18. XML code that defines a customization for the MultiSolutionAddInInstaller assembly

    Customization for multi-solution assembly
  19. In the ExcelSmartTagAddIn manifest, scroll down to the customizations section and copy the XML that defines the Excel add-in customization.

    Figure 19. XML code that defines the customization for the Excel add-in assembly

    Customization for the Excel add-in assembly
  20. In the MultiSolutionAddInInstaller manifest, replace the XML that specifies that the customization for the MultiSolutionAddInInstaller assembly with the XML you just copied.

  21. In the WordSmartTagAddIn manifest, scroll down to the customizations section and copy the XML that defines the Word add-in customization.

    Figure 20. XML code that defines the customization for the Word add-in assembly

    Customization for the Word add-in assembly
  22. In the MultiSolutionAddInInstaller manifest, add the XML you just copied after the XML you just pasted.

  23. You now have two customization elements. Add the following XML in bold to uniquely identify them:

    <vstav4:customization id="MultiExcel">
    …
    < vstav4:customization id="MultiWord">
    
  24. Save your changes to the MultiSolutionAddInInstaller application manifest and close the application manifest files.

  25. In the Windows Explorer, navigate to the folder that contains the MultiSolutionAddInInstaller project.

  26. Copy the MultiSolutionAddInInstaller_TemporaryKey.pfx file into the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder in the publish folder. This file is the temporary certificate created by Visual Studio. When you deploy a solution into production, you should use a certificate obtained from a certification authority.

  27. Open the Visual Studio command prompt.

  28. Change to the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder.

  29. Type the following command all on one line to re-sign the application manifest: mage -sign MultiSolutionAddInInstaller.dll.manifest -certfile MultiSolutionAddInInstaller_TemporaryKey.pfx

  30. The message "MultiSolutionAddInInstaller.dll.manifest successfully signed" appears.

  31. Change to the publish folder.

  32. Type the following command all on one line to update and re-sign the deployment manifest: mage -update MultiSolutionAddInInstaller.vsto -appmanifest "Application Files\MultiSolutionAddInInstaller_1_0_0_0\MultiSolutionAddInInstaller.dll.manifest" -certfile "Application Files\MultiSolutionAddInInstaller_1_0_0_0\MultiSolutionAddInInstaller_TemporaryKey.pfx"

  33. The message "MultiSolutionAddInInstaller.vsto successfully signed" appears.

  34. In the Windows Explorer, copy the MultiSolutionAddInInstaller.vsto file from the publish folder to the Application Files\MultiSolutionAddInInstaller_1_0_0_0 folder.

Installing the Add-Ins

When you build or publish an Office add-in project, Visual Studio installs the add-in. This is convenient for testing purposes. If you open Excel at this point, you see that the ExcelSmartTagAddIn and MultiSolutionAddInInstaller are installed. If you open Word, you see that the WordSmartTagAddIn are installed. However, if you run the setup routine at this point on your development computer, it will fail because the add-ins are already installed. Therefore you must uninstall them first. You also use the mage utility to clear the ClickOnce cache.

Note that you do not have to take these steps on users' computers. These two steps are only required on your development computer.

To install the add-in

  1. In Visual Studio, on the Build menu, select Clean Solution. When you clean an Office add-in project, Visual Studio uninstalls the add-in.

  2. In the Visual Studio command prompt the following command to clear the ClickOnce cache: mage -cc

  3. In the Windows Explorer, navigate to the publish folder.

  4. Double-click Setup.exe. The Microsoft Office Customization Installer dialog box appears.

  5. If you receive a Publisher cannot be verified warning, click Install to continue.

    Figure 21. Installing the customization

    Installing the customization
  6. Click Close when the dialog box informs you that the customization was successfully installed.

    Figure 22. The successful customization installation

    Successful installation
  7. Open Excel. You should see that the add-in is installed.

  8. Open Word. You should see that the add-in is installed.

  9. Close Excel and Word.

  10. From the Windows Start menu, open Control Panel and select Programs and Features.

  11. Select the MultiSolutionAddInInstaller icon and then click Uninstall.

  12. Open Excel. You should see that the add-in is no longer installed.

  13. Open Word. You should see that the add-in is no longer installed.

  14. Close Excel and Word.

Read It

The ability to install multiple Office solutions at the same time is very useful and is sure to be popular with users. Running one setup routine instead of several setup routines not only saves time, but also ensures users install of the add-ins. Imagine a solution that uses three add-ins and requires all three to be installed. If you relied on the users to install all three, there is the risk some users only install some of the add-ins. Combining the installations into a single install guarantees that users who install the solution install the complete solution.

The same guarantee holds at uninstall time. Users who uninstall the solution will uninstall the complete solution. This eliminates a potential problem if they try to install the solution in the future. If they partially uninstalled it because they only uninstalled two of the three add-ins, then the reinstall attempt could fail.

You can see that creating a single install/uninstall saves time and reduces problems.

See It

Watch the video

Watch video

Length: 00:20:29

Click to grab code

Grab the Code

Explore It

About the Author

Robert Green is a developer, writer, and trainer. He is a senior consultant with MCW Technologies. Robert is a Visual Studio Tools for the Office system MVP and is a co-author of AppDev courseware for Microsoft Visual Basic, Microsoft Visual C#, LINQ and Microsoft Windows Workflow Foundation. Before joining MCW, Robert worked at Microsoft as a Product Manager and also a Program Manager.

Show: