Adding the Office Primary Interop Assemblies as a Prerequisite in your ClickOnce installer (Mary Lee)

Rate This
  • Comments 46

When you use ClickOnce in Visual Studio 2008 to deploy your Office solution, you can include prerequisites such as the .NET Framework 3.5, the Visual Studio Tools for Office system 3.0 Runtime, and Windows Installer 3.1.  However, the primary interop assemblies (PIAs) for the 2007 Microsoft Office system are not automatically listed in the Prerequisites dialog box. 

Fortunately, you can add the PIAs to the Prerequisites dialog box. The following procedure adds the 2007 Microsoft Office Primary Interop Assemblies to the Prerequisites Dialog Box. This procedure may look lengthy, but you only have to do it once.

1.  Download the OfficeVSTO2005SEWindowsInstallerV3.msi sample, which is part of the deployment whitepaper at Deploying Visual Studio 2005 Tools for Office Second Edition Solutions Using Windows Installer (Part 1 of 2).

2. Install OfficeVSTO2005SEWindowsInstallerV3.msi.

3. Copy the contents of %ProgramFiles%\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\packages to %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages

4. Compile the component checker. This step checks if the computer has the correct version of Office installed to match the PIAs that are being installed.

a) Open a Visual Studio command prompt

b) Change directories to %ProgramFiles%\Microsoft Visual Studio 2005 Tools for Office SE Resources\VSTO2005SE Windows Installer Sample Version 3\projects\Checks

c) Type the following command: cl.exe /Oxs /MT /GS ComponentCheck.cpp advapi32.lib

d) Copy ComponentCheck.exe to the %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA folder and the %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2003PIA folder.

5. Download and extract the Office 2007 PIAs from 2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies.

6. Copy the o2007pia.msi file to the %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2007PIA folder.

7. In VS2008, on the Project menu, click ProjectName Properties.

8. Click the Publish tab.

9. Click the Prerequisites button to open the Prerequisites dialog box.

You should see the PIAs listed in the Prerequisites dialog box like the following image. Because the package.xml file does not define a HomeSite (a location to download the file), you will see a build warning.  Even if you have selected Download prerequisites from the component vendor's web site, the PIAs will go into a directory alongside your solution installer.

Prerequisites

If you want to learn more about adding your own entries to the Prerequisites dialog box, see Adding Custom Prerequisites.

For more information about common problems when deploying the Office primary interop assemblies, see http://blogs.msdn.com/vsto/archive/2008/05/20/common-pitfalls-during-pia-deployment-and-installation.aspx.

For troubleshooting assistance, try the VSTO Power Tools, a suite of tools to help you develop and deploy Office solutions. For example, you can use the VSTO Troubleshooter to examine end user computers for missing prerequisites.

Mary Lee, programming writer.

Leave a Comment
  • Please add 1 and 4 and type the answer here:
  • Post
  • First things first.... you can download the content from my SkyDrive below. Next, let's address the unanswered

  • Thanks a lot,

    I have done everything for office 2003 PIA and Office 2007 PIA for prerequisites,

    and the binaries, I have uploaded to the rapidshare for the other users, who don't want to waste the time to build the .cpp files and downloading the PIA's from microsoft's site,

    here is the blog URL: http://office-development.blogspot.com/

  • There appears to be a bug in the product.xml file for the Office2003PIA.  Product.xml Lines 25 and 39 specifiy o2003pia.msi when the file is actually o2003pia.exe.  Changing this clears the errors encountered when building a setup project.

  • In a previous post I gave you a brief description of Click-Once vs. Windows Installer based deployment

  • I want to install 0ffice 2003 PIA using BootStrapper.

    I had a problem that,

    Iam using the following link in Product.xml. "http://download.microsoft.com/download/8/3/a/83a40b5a-5050-4940-bcc4-7943e1e59590/O2003PIA.EXE"

    So it  not downloading "o2003pia.msi" from the above url and throwing the following error.

    Error:

    Setup has detected that the file 'C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\VSDB7.tmp\O2003PIA\O2003PIA.msi' has either changed since it was initially published or may be corrupt.

  • I am facing a wierd problem. I have developed an Excel 2007 Addin using c# in VS 2008. The addin is working fine on my PC. Now when i create a setup and install the same addin on anather PC the installation is successful but the New Component does not show in the excel 2007 ribbon on the PC. Kindly help, its really stuck

    Thanks and regards

    Shantanu

  • I have few solutions for this problem. Just try with the following things.

    1. Install Office 2007 PIA's.

      http://download.microsoft.com/download/4/7/9/4792dd7c-c06d-456e-a8be-2d5176e6f618/Office2007PIA/o2007pia.msi

    Then Install your Addin.

    2. Even then if it is not working, remove all the registry entries of your addin. The install your addin.

  • @Terry: about your text:

    Terry Downing said on October 21, 2008 2:47 PM:

    There appears to be a bug in the product.xml file for the Office2003PIA.  Product.xml Lines 25 and 39 specifiy o2003pia.msi when the file is actually o2003pia.exe.  Changing this clears the errors encountered when building a setup project.

    the product.xml is correct.  you need to run the O2003pia.exe to extract three file: o2003pia.msi, a readme file, and a EULA file.

    m.

  • Hello All

    Thanks for the comments. But still addin is not loading on the client machine. I will be highly obliged if anyone can provide me the steps of Setup and Deployment for C# Excel 2007 project in Visual studio 2008. It will help me a lot .

    thanks and regards

    Shantanu

  • Hi Shantanu,

    I think there is a problem in your setup.

    Please follow the below steps.

    1. Create a setup project.

    2. Then right click on setup project select  Add -> Project Output . Select your Add in project and select Primary output and click on Ok.

    3. Again right click on setup project select  Add -> Project Output . Select your Add in project and select Content Files and click on Ok.

    4. Then add .vsto and .dll.manifest files of your addin project which we will get in bin\debug folder.

    5. Finally create registry entry under HKCR like  Software -> Microsoft -> Excel -> Addns -> ur AddinName . Create  

    Name                            Value

    LoadBehaviour           3                            

    Manifest                      “[TARGETDIR]UrAddin.vsto|vstolocal”

    Here LoadBehavior is {Binary value} and Manifest is {String value}.

  • Hi Pavan

    i dont know what is missing but its still not working.

  • Worked great for me thanks....

  • For some reason, PIA doesn't show up as a pre-requisite to my Excel 2007 Add-in project (which registers as a Com add-in).  Why is this?  When I install on the end-user machine it requests the Microsoft.Office.Interop.Excel assembly.... because of this I can't enforce it as a prerequisite.

  • Alan,

    the PIAs for Microsoft Office 2007 do not appear automatically in the Prequisites Dialog Box until Visual Studio 2008 SP1. you can either install VS2008 SP1, or you can create the bootstrapper package for the Microsoft Office 2007 PIAs by following the instructions in this blog entry.

    m.

  • Hi Shananu,

    I am having the same issue, I am deploying a VSTO 3.0 Outlook addin. Funny thing is that a Custom Region will display no problem.

    However when I deploy a ribbon customization(visual designer i VSTO 3.0 VS2008 SP1) when i come to install at client side (WS 2008 64Bit) the Ribbon is missing.

    I have installed the opia2007.exe have created test simple projects and still the same. It works fine on my setup.

    Another intersting thing is that I noticed that the ribbon did flash up for a moment then hide. Is it something to do with the Ribbon assembilies? Or did you ever find a solution.

    James

Page 3 of 4 (46 items) 1234

Adding the Office Primary Interop Assemblies as a Prerequisite in your ClickOnce installer (Mary Lee)