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

Rate This
  • Comments 47

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.


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

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.

  • PingBack from

  • Can you elaborate on what you are doing in step 4 and why this is done?


    -= Maarten =-

  • hi Maarten -  thanks so much for providing quick comments.  step 4 looks at the version of Office that is installed - to ensure that the correct version of the PIAs are being installed.  if a different version of Office is on the end user computer, then the PIAs are not installed.


  • I had to update step 4, part d from  d) Copy ComponentCheck.exe to %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages.


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

    to get the addin project to compile.  Is this incorrect?

  • the ComponentCheck.exe should go into the PIA folder.  i've updated the path to be correct.  thanks for pointing that out!


  • This was an excellent article  - thank you. What steps do I need to change if I was distributing my Visio Add In,  I created using Visio 2008 , to the user community running Office 2003?

    You help is greatly appreciated

  • hi Abhi,

    if you followed step 3, you already have the Office2003PIA folder in your VS bootstrapper directory.  that means if you go to the Project menu, click <ProjectName> Properties, click Publish, and then click Prerequisites, you should see "Microsoft Office 2003 Primary Interop Assemblies" in the list of prerequisite components to add to your installer.  also, for the Office 2003 PIAs, you don't need to copy the ComponentCheck.exe to that directory.

    though you will not be able to use ClickOnce to deploy your Office 2003 solution, you can use a Setup and Deployment project and access the Prerequisites dialog box through there.


  • to be more specific, Chris Castillo has blogged about deploying VSTO/Visio add-ins at  while the blog entry is VS2005 specific, the steps for VS2008 are similar because  the VSTO 2005 SE runtime is used for Office 2003 solutions by both versions of VS.

  • Hi,

    So I removed the Componentcheck.exe from the Office2003PIA folder under bootstrapper directory. Now I cannot compile the add in setup because it gives me the error -

    " Error 6 Could not find required file 'c:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\Office2003PIA\ComponentCheck.exe' for item 'Microsoft Office 2003 Primary Interop Assemblies'. "

    And if I put it back, i can compile but keep getting this new error on the user machine -

    "Error 1001: Unable to get installer types in the <assembly.dll> -> Unable to load one or more of the registered types. Retrieve the LoaderException property from more information"

    Any help is greatly appreciated.

  • Hi,

    So Now I have reached a stage where the add in works fine on my development machine but it does not load when deployed through the setup (using msi installer) on the user machine. I have included the following as prerequisite , considering i built this in VS 2008 and deploying on Office 2003 user machine -

    - .net 2.0

    - 2003 primary interop assembly

    - visual studio 2005 tools for office se runtime

    but again yes i do need to include the ComponentCheck under the Office2003PIA because VS2008 will not build the setup program without it.

    Now the install completes ok on the user machine but the add in does not work.

    PLEASE , someone HELP

  • hi Abhi,

    the definitive whitepapers to deploy Office 2003 solutions with a setup project are at the following links:

    these are important to read because the security and deployment models are entirely different for Office 2003 and Office 2007.

    if you have specific problems with your deployment, please post your question with error messages at the VSTO MSDN forum at

    there are many people there who can assist you better than through blog comments.

    thanks for all your feedback!


  • The best article to overcome the missing Primary Interop Assemblies. You are great!

  • Should it not be %ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\ ?  I certainly don't have a %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\ directory.  Using %ProgramFiles%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\ instead worked for me.  I could not see the Primary Interop Assemblies or the VSTO Runtime listed in the Prerequisites list in VS 2005 when creating a setup project for a Word 2007 AddIn project.


  • hi Craig,

    this blog entry is for VS2008, so the path is correct.  

    for VS2005 information, you can click on the "Adding Custom Prerequisites" link in the last line of the blog entry.  click "Other versions are also available for the following: Microsoft Visual Studio 2005/.NET Framework 2.0" in the box in the upper right of the topic to go to the VS2005 topic.  this topic lists list \Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages as the correct path for VS2005.


  • Great article - but a minor setback in regards to item 4 :

    I dont have the header files required for compiling the ComponentCheck - so, what do I do now?

Page 1 of 4 (47 items) 1234

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