Deploying Multiple Office Solutions In a Single Installer (Mary Lee)

  • Comments 8

Starting in Visual Studio 2010 Beta 1, you can deploy multiple Office solutions in a single ClickOnce installer. For example, you can develop two Office solutions (one for Outlook and another for Excel) and combine these into a single installer with a single entry in the Add/Remove Programs list in Windows XP and the Programs and Features list in Windows Vista.

image

The Visual Studio Tools for Office runtime supports the ability to deploy multiple Office solutions in a single installer. However, Visual Studio still generates the ClickOnce application and deployment manifests for individual deployment. To deploy multiple Office solutions in a single installer, you must modify the application and deployment manifests to install multiple assemblies. This process is demonstrated in the Walkthrough: Deploying Multiple Office Solutions in a Single ClickOnce Installer topic in the MSDN Library.

Creating Multiple Office Solutions

To continue the example mentioned in the introduction, you can develop an Excel workbook project and an Outlook add-in project for .NET Framework 3.5. Then, to deploy both of these, create an installer project, which you can re-use later to add a third or fourth project. By keeping this installer project separate, it’s possible to keep the original files for the individual projects intact. In this example, the installer project is based on a Word document project, but the document isn’t being deployed. The following figure shows Solution Explorer with three projects, one installer project and two projects to deploy to end user computers.

image

 

Publishing the Office Solutions

After you add your code to the Excel and Outlook projects, publish the ContosoExcelWorkbook, ContosoOutlookAddIn, and then ContosoInstaller projects (in that order) to a folder on the development computer. You can right-click on the projects in Solution Explorer, and then click Publish. In this example, the publish directory is c:\publish.

image

Modifying the Application Manifest

Visual Studio generates an application manifest and deployment manifest for each project. The ClickOnce application manifest is a description of all the files included in the project. Additionally, this file describes how the Office application could load the assembly and run your code. By modifying the application manifest, you can describe files from multiple projects and install all specified projects. There are three different sections of the application manifest to modify: install dependencies, entry points, and assemblies.

These changes may appear lengthy, but it really amounts to a few copy-paste operations and adding four words to the application manifest.

Adding the Install Dependencies

1. In the c:\publish\Application Files folder, copy the contents of the ContosoExcelWork_1_0_0_0 and ContosoOutlookAddIn_1_0_0_0 folder into the ContosoInstaller_1_0_0_0 folder.

2. From the c:\publish\Application Files\ContosoInstaller_1_0_0_0 folder, open the three .dll.manifest files in the XML editor in Visual Studio.

3. Copy the <dependency> block for the Office customization assembly from the ContosoOutlookAddIn.dll.manifest and ContosoExcelWorkbook.dll.manifest files into the ContosoInstaller.dll.manifest file. This code specifies that the ContosoOutlookAddIn.dll and ContosoExcelWorkbook.dll files are part of the ContosoInstaller project.

4. Delete the <dependency> block for the ContosoInstaller.dll. This file is not part of the project, because you are only using the ContosoInstaller project to generate the application manifest template.

image

 

Adding the Entry Points

1. In the ContosoInstaller.dll.manifest file, delete the text between the <vstav3:entryPointsCollection> and </vstav3:entryPointsCollection> elements.

2. In the ContosoOutlookAddIn.dll.manifest and ContosoExcelWorkbook.dll.manifest files, copy the text between the <vstav3:entryPointsCollection> and </vstav3:entryPointsCollection> elements and paste them into the ContosoInstaller.dll.manifest file.

image

3. Add an id to the <vstav3:entryPoints> elements.

image

Adding the assemblies

1. In the ContosoInstaller.dll.manifest file, delete the text between the <vstov4:customizations xmlns:vstov4="urn:schemas-microsoft-com:vsto.v4"> and </vstov4:customizations> elements.

2. In the ContosoOutlookAddIn.dll.manifest and ContosoExcelWorkbook.dll.manifest files, copy the <vstov4:customizations xmlns:vstov4="urn:schemas-microsoft-com:vsto.v4"> and </vstov4:customizations> elements and paste them into the ContosoInstaller.dll.manifest file.

image

3. Add the id name to the <vstov4:customization> elements.

image

4. Save the changes in the ContosoInstaller.dll.manifest file, and close the ContosoExcelWorkbook.dll.manifest and ContosoOutlookAddIn.dll.manifest files.

Re-Signing the Manifests

To prove that yes, you really meant to make these changes to the application manifest, you must re-sign the application manifest with a certificate. Then, re-sign and update the deployment manifest to point to the new application manifest.

1. Copy your certificate to the c:\publish\Application Files\ContosoInstaller_1_0_0_0 directory. In this example, I’m reusing the temporary certificate created by Visual Studio because I’ll be installing this to a test computer. For production deployment, we recommend that you use a certificate obtained from a certificate authority.

2. In a Visual Studio command prompt, change to the c:\publish\Application Files\ContosoInstaller_1_0_0_0 directory. (You may have to open the command prompt in Administrator mode to re-sign the files in the c:\publish directory.)

3. Re-sign the application manifest with the following command:

mage -sign ContosoInstaller.dll.manifest -certfile ContosoInstaller_TemporaryKey.pfx

4. Change to the c:\publish directory

5. Re-sign the deployment manifest with the following command (on one line):

mage -update ContosoInstaller.vsto 
-appmanifest "Application Files\ContosoInstaller_1_0_0_0\ContosoInstaller.dll.manifest" 
-certfile "Application Files\ContosoInstaller_1_0_0_0\ContosoInstaller_TemporaryKey.pfx"

6. Copy the c:\publish\ContosoInstaller.vsto file to the c:\publish\Application Files\ContosoInstaller_1_0_0_0 directory.

Testing the Installer

1. Copy the c:\publish directory to a test computer.

2. In the publish directory, run the Setup.exe file or double-click ContosoInstaller.vsto.

3. Verify that ContosoInstaller appears in the Add/Remove Programs list in Windows XP or Programs and Features in Windows Vista.

image

4. Open the Excel workbook file and Outlook to verify that your code is running.

 

Feel free to leave comments and feedback about this new scenario at the bottom of this article.

Happy deployment!

Mary Lee, Programming Writer.

Leave a Comment
  • Please add 2 and 1 and type the answer here:
  • Post
  • PingBack from http://microsoft-sharepoint.simplynetdev.com/deploying-multiple-office-solutions-in-a-single-installer-mary-lee/

  • This week, I&#8217;m featuring the topic: Walkthrough: Deploying Multiple Office Solutions in a Single

  • Mary Lee recently posted a blog entry that describes Deploying Multiple Office Solutions in a Single

  • Can we do the same thing with VS2008 ?

  • Any time I see so much copy/paste of "XML goo" involved in creating solutions like the one you refer too in one of these "how to" blogs, I want to scream "the tools aren't ready yet"!  Where is the visual design experience?  This sort of monkey-see monkey-do copy/paste technique takes me back to how bad Office and SharePoint development was under Visual Studio 2005.  When will Microsoft learn: you don't release half-baked toolsets along with the product.  It's obvious that what you're doing is what I as a developer refer to as "hacking the tools" to make up for a severe deficiency in the tool (Visual Studio 2010's Office 2010 project templates in this particular instance).

  • Is this also possible to do in MSI Installer deployment? ClickOnce installera s far as I know only supports SIngle user install, and MSI installers in VSTO 2010 supports all users install.

  • i have created a setup using this method . but this setup is showing error in "ContosoInstaller.dll.manifest"

  • Mary Lee!

    Thank you for the great article. Also I have followed the MSDN article on msdn.microsoft.com/.../dd465290(VS.100).aspx.

    I am having a question regarding how the Updates are applied when there is a new version available in the publishing location.

    My requirement is to install a "Excel Template Customization" and a "Excel Add In " using click once.

    So I have followed the methodology mentioned in this article.

    That is,

    => Create an Installer Add-in,

    => This will handle the Installation of "Excel Template Customization" and a "Excel Add In " to my computer using click once.

    1. After installing the installer add-in, I can see only one entry in Add-Remove Programs - That is Fine.

    2 This has installed the "Add-in" and "Excel Template" to my computer - This also Fine

    3. I have copied the "Excel Template" file to the DESKTOP and opened the template to check the current version is working OK - This also fine

    4. Next I have done some changes "Excel Template Customization" project and the "Add-in" project.

    5. After that I have published above projects and INSTALLER Add-in  to the the previous published location.

    6. Now the location is updated with the new version.

    7. IF I run the "Excel Template" [that was in the DESKTOP From Previous Installation] I would expect to download the updates from the published location and apply the updates.

     BUT THE VERSION IS NOT UPDATED AUTOMATICALLY [Even though I have set the "Customization Updates" settings to the "Check  every time the customization runs" option, to all the Projects]

    It is only updated when I run the Installer Add in Again.

    Can You please let me know if there is any way to install the updates automatically? [ That is,  without running the installer I required to get the updates when I open the Template file that I have copied into my DESKTOP from the previous installation]

Page 1 of 1 (8 items)

Deploying Multiple Office Solutions In a Single Installer (Mary Lee)