Common Pitfalls during PIA Deployment and Installation (Mary Lee)

Published 20 May 08 12:05 PM

Deploying or installing the Office primary interop assemblies (PIAs) can sometimes be problematic. There are several common errors that occur when you try to deploy or install the PIAs.

Deployment pitfalls

A. Can I deploy the PIA DLL with my setup project?  Yes, you can include the PIA DLL in your setup project, but we recommend that you use the Primary Interop Assemblies for the 2007 Microsoft Office system redistributable file from the Microsoft Download Center.  this way, the installer copies the PIAs into the GAC, and also installs binding redirects.  The binding redirects ensure that the latest version of the PIAs on the computer are always loaded.  This is how a solution developed for Microsoft Office 2003 still works on the 2007 Microsoft Office system.

Installation pitfalls

A. Do you have administrator privileges? The account used to install the PIAs must have administrator privileges.

B. Is the .NET Framework already installed? The computer must have a version of the .NET Framework installed (version 1.1, 2.0, 3.0, or 3.5) before the PIA installer is run. Windows XP does not include any version of the .NET Framework unless .NET 1.1 was downloaded from Windows Update. Windows Vista does include a version of the .NET Framework. When Microsoft Office is first installed, the .NET Framework installation is detected and the PIAs are automatically installed.

C. Is Business Contact Manager installed? If Outlook 2007 with Business Contact Manager is already installed on the computer, you may see the following error message when you install the Primary Interop Assemblies for the 2007 Microsoft Office system from the Microsoft Download Center:

Error 1316: Setup cannot read from file {PATH}\PIARedist.MSI. Check your connection to the network, or CD-ROM drive. For other potential solutions, see SETUP.CHM.

Business Contact Manager for Outlook 2007 installs the PIAs by default, and the file name is PIARedist.MSI.  However, the file from the Microsoft Download Center is called o2007pia.msi.  When you install the PIAs from the Microsoft Download Center, this name conflict causes the 1316 error.

The easiest thing to do here is to just ignore the error, because this message means that the PIAs are already installed. If you want to correct the error, uninstall the PIAs through the list of installed programs for the specific computer. Then you can reinstall the PIAs with the Primary Interop Assemblies for the 2007 Microsoft Office system from the Microsoft Download Center.

I don't recommend that you follow the workaround posted at Error 1316 when installing Office 2007 PIA’s, which changes the name of the o2007pia.msi file to piaredist.msi and updates the product.xml to point to piaredist.msi.  If you change the name of the o2007pia.msi, anyone that installs the PIAs after you will experience the 1316 error.

If you discover other PIA pitfalls, please feel free to leave a comment or question so I can update this entry.  Thanks for reading!

Mary Lee, programming writer.

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Office Development with Visual Studio said on August 19, 2008 12:50 PM:

When you use ClickOnce in Visual Studio 2008 to deploy your Office solution, you can include prerequisites

# Anders said on September 26, 2008 12:38 AM:

How can I use Office 2007 (Daily use, not for programming), but program using office 2003 PIA's. Once office 2007 is installed, my computer default all PIA's to 2007, no matter how much I try to uninstall them (hard), or install in new sequences (office 2007 first, then 2003).

# VSTO Team said on September 26, 2008 3:14 PM:

hi Anders,

you cannot install multiple versions of Microsoft Office on a development computer - for precisely the reasons that you noticed.  from http://msdn.microsoft.com/en-us/library/bb398242.aspx

"Visual Studio Tools for Office does not support installing Microsoft Office 2003 and the 2007 Microsoft Office system (or different versions of the same application, such as Word 2003 and Word 2007) side-by-side on the development computer. To develop solutions for different versions of Microsoft Office, use a different development computer for each version of Microsoft Office."

installing the PIAs also installs binding redirects, which always point to the latest version of the PIAs.  this enables Office 2003 add-ins and customizations to work in future versions of Office.  

for more background, see the following blog entry from a VSTO architect: http://blogs.msdn.com/andreww/archive/2007/06/08/why-is-vs-development-not-supported-with-multiple-versions-of-office.aspx

m.

# Don said on October 29, 2008 10:05 PM:

I have VS2005 Pro installed. I also have Office 2003. The PIA's show up in the GAC, but not when I try to add a reference in VS. I have .Net Framework 2.0.

I have tried reinstalling both VS and Office in different orders. I have also tried the fixes recommended by MSDN.

# VS2005 said on January 16, 2009 11:17 PM:

I have installed the 2007 PIA and repaired my Office 2007 installation.

Still, when I add a reference to the Office 12 Object Library in VS2005, I only see Office.Core and cannot add an 'imports' statement for Office.Interop

Have checked that Windows\assembly\gac\ has got the interop dlls

# VSTO Team said on January 17, 2009 11:24 AM:

The core "Office" PIA (which is what your project references when you add a reference to the "Microsoft Office 12.0 Object Library"; this PIA defines types used in all Office applications) contains only the 'Microsoft.Office.Core" namespace. You can verify this by viewing the contents of this PIA assembly in Object Browser after you reference it in your project.

I am not aware of any "Office.Interop" namespace in any of the Office PIAs, but the PIAs for individual Office applications do have namespaces in the format "Microsoft.Office.Interop.<app name>". For example, if you add a reference to the Microsoft Excel 12.0 Object Library, the namesapce of the types in this PIA is "Microsoft.Office.Interop.Excel". Does this help?

# Tom said on January 30, 2009 2:28 PM:

Since the product.xml file in the Office2007PIARedist does not contain a Homesite like other Microsoft packages, what is the recommended way to fix or suppress the build warning?

MSB3164

"No 'HomeSite' attribute has been provided for 'Microsoft Office 2007 Primary Interop Assemblies', so the package will be published to the same location as the bootstrapper."

# VSTO Team said on January 30, 2009 2:52 PM:

Tom,

to fix this, you can select Download prerequisites from the same location as my application radio button or uncheck the PIAs from the Prerequisites Dialog Box.  you should only do the latter if the PIAs are already installed.

m.

# Tom said on January 30, 2009 4:06 PM:

Thank you for the quick response.

I was afraid you were going to say that as unfortunately that isn't practical.  I can't imagine a business case to not check the "Download prerequisites from component vendor's web site" and you are correct that we can not assume our clients already have the office PIAs installed.

Has there been any discussion at Microsoft about adding a valid office homesite?

Correct me if I'm wrong, but if "Download prerequisites from component vendor's web site" is checked for the office package, it simply ignores the flag and finds them from the local location.

Is there a way to explicitly specify this behavior so that functionally it is equivalent without actually having that warning?

All of our attempts to suppress that warning in the project are ignored by msbuild.  It is entirely possible we are doing something wrong, but the only proposed work around we have come up with which is functionally equivalent would be to build the project in a batch file and return a passing state if just this warning appears - which seems rather extreme to avoid a warning and a really poor build design.

# Biren Patel said on March 9, 2009 10:43 AM:

I'm trying to create a setup project using Visual Studio 2008 SP1 that will install the PIAs as a prerequisite.

In the prerequisites screen, Microsoft Office 2007 Primary Interop Assemblies is a checkbox option - but after selecting this and building the project, the PIA installation does not run when running the setup.exe.

Looking in the Office2007PIARedist folder there is only a o2007pia.msi, but this is not being run.

.Net framework is installed on the machine.

Am I missing a step when building my project?

# rcook said on March 12, 2009 1:25 PM:

I have a few comments relating to ComponentCheck.exe here: http://blogs.msdn.com/rcook/archive/2009/03/12/issues-with-office-2007-pia-redist-and-componentcheck-exe.aspx

# Gary said on March 14, 2009 2:53 AM:

Hi, hope you can help me here.  I've a VB.Net program that creates an Excel 2007 file.  It works well on my computewr since Office 2007 is installed.  I need to deploy the program in our production server wherein there is no MS Office installed.  I created a package which includes the InterOp assemblies but I always get the error that the ActiveX component couldn't be created.  I tried registering the DLLs using regsvr32 (fails) and regasm (successful but useless) but still got the same error when I run the application.  Has anyone deployed a VB.Net program that uses Office 2007 InterOp Assemblies on a server that has no Office installed?

# Mask said on March 17, 2009 11:40 AM:

Hello Developers,

I'm trying do develop an Addin, and I'm having some problems with PIA's. This Addin is directed to MS Project 2007 but I wanted to export my Data to MS Excel 2003. After I've tried and broke my head among the references and didn't found a solution.

I'm wondering, since Ms Project 2007 use PIA 12.0 and MS Excel use PIA 11.0 I think Visual Studio 2008 can't have references for both PIA (which is normal).

Do I have to develop the Addin to diferent cases (eg: 1 Addin to Ms Project 2007 with Ms Excel 2007 and another to MS Project 2003 with Ms Excel 2003)?

Is it possible to mix up to Kinds of version (eg: 1 Addin to Ms Project 2007 with Ms Excel 2003 and another to MS Project 2003 with Ms Excel 2007)?

I really appreciate your help,

Best Regards,

Mask

# luihond said on March 20, 2009 2:56 PM:

Hi. I have developed an application using Office12.  However, the target PC's have office 2003 or Office Xp installed.  When I install the application and try to run it It errors.  I think it is to do with me using Office 2007 reference.  Is there a way of getting my application to work without having to change my code to reference the Office XP or Office 2003 COM references?

# Christin Boyd said on March 20, 2009 3:15 PM:

Hi Luihond -

If you use Visual Studio 2005 or Visual Studio 2008 to target your solution for Office 2007, then you should expect it to error and not run on older versions of Office.  In order to target Excel 2003, you would need to create a new project, and then you can probably copy and paste most of your code into the new project.  The VSTO tools do not target Office XP.  

Sincerely,

Christin Boyd

Program Manager

Visual Studio

# AndrewM said on March 26, 2009 11:24 AM:

Response to #Mask.

I have developed an application that uses Office Interop and run in on a server without office installed. However, if I try to use the Office integration features of the application I do get an error.

The application runs because the interop references are all in class files that are not loaded until they are needed. So the application can run without trying to initialise any office components.

# Karthik said on April 1, 2009 4:49 AM:

From where can I download PIA's for Excel 2003 which can be Installed in Win Vista..

The links that I ve checked says it supports only upto Win XP for Office 2003

# Christin Boyd said on April 1, 2009 2:07 PM:

Karthik -

The Excel 2003 (and Office 2003) PIAs are fully supported on Vista and Windows XP.

Christin Boyd

Program Manager

Visual Studio

# rbonilla said on May 12, 2009 4:50 PM:

I wrote vb.net application with interop to microsoft project 2007 with the PIA files including, i make the installation in another computer but when i run the program, receive the message error msg COM+ register error.

Maybe it's because the computer don't have the ms project install ??

# Robin said on May 15, 2009 8:21 PM:

Hi I have developed a .Net application in 2003 which uses opens word 2003 document and takes word document from user. Right now we build 2 setups one with Office 2003 - 11 PIA and one for office 2007 PIA.

Can we combine both the setups. So that we just have once setup made in office 2003 works on 2007 also?

# ASPInsiders said on May 19, 2009 8:43 PM:

Just got a great tweet from Jeremiah Morrill about .NET 4. I love a challenge! In my first Whirlwind

# Kevin said on June 24, 2009 6:46 AM:

Hi everybody!

I am developing a commercial software (shareware) that accesses Outlook 2007 through PIA. Are there any Microsoft license issues? I don't ship the PIA with my installer.

Thanks!

# Paul said on July 14, 2009 11:06 AM:

Well, I'm developing a WPF application that uses powerpoint to convert a PPT file to an XPS file so that the WPF Document Viewer can use it.  Basically, if I can't convert (which the Office 2003 interops won't do) then WPF is useless to me.

Any ideas on how I can get the WPF Document Viewer to access the file properly?  My users are a mixed bag of Office 2003 and 2007 users.  The 2007 users, the application works fine.  The 2003, I can't get the interops installed at all.

# Raghvendra said on August 14, 2009 3:35 AM:

Hi,

I want to know if net framework 1.1 is strictly required for PIAs or if we have higher version of .net framework let's say 2.0 or 3 or 3.5 without having 1.1 installed, will PIA work.

Thanks in advance!

Please send your reply to raghvendra.d@gmail.com

# VSTO Team said on August 14, 2009 12:56 PM:

.NET Framework 1.1 is the minimum version. Any later version of the .NET Framework will work fine too.

m.

# Simon said on August 31, 2009 1:32 PM:

We have an application that uses the Office Interops to open and read Office documents. However our application also runs without Office installed on the target machine - in that case Office documents are not supported.

Currently we deploy the interops directly with our app but we would like to use the proper approach and use the PIA installer to install the PIAs. You say, however, that the PIAs are only installed if Office is installed on the target machine. Office is not a prerequisit for our app, it's just an option, but since our app references the PIAs the PIAs are a prerequisit.

Is there a way to install the PIAs without Office installed so that an app that references the PIAs will run even so Office is not installed?

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

About VSTO Team

This login represents the Visual Studio Tools for Office team. Many members of the team us this account for publishing technical blog posts.

This Blog

Syndication

Page view tracker