Why doesn't the office PIA install correctly to the GAC?
Asked Answered
V

2

16

I am currently working on a c# project, where I need to access Outlook. The development is being done on two different machines, one of which has office installed, and one of which doesn't. I previously asked how to compile my project against the outlook com object, and one of the comments suggested that I compiled against the office primary interop assembly, or PIA. In my downloaded Office 2007 PIA, there is an msi file, that is supposed to install a number of PIAs for the different parts of Office. My problem is that this seemingly doesn't happen. On my office-less machine, after typing

msiexec /i o2007pia.msi

at a prompt, the windows installer starts up, with a message box showing "Please wait while Windows configures Microsoft Office 2007 Primary Interop Assemblies. Gathering required information" along with a progress bar at about 33%, after which it disappears, and after which

gacutil -l microsoft.office.interop.outlook

yields no results for Office 2007 (I do get a result, which is versioned 10.0.4504.0 and is the result of an earlier installation attempt with a wrong Office version., but Office 2007 PIAs have major version 12.)

I see a couple of possible explanations, none of which I really believe in:

  • GAC can't handle multiple versions of the same assembly, and so won't allow me to install a newer version.

  • Somehow I don't fulfil the requirements. These are basically XPsp2, and .Net 1.1 or above, both of which I have. The requirements section also mentions, that the download works with office 2007, which I don't have installed, but I don't think this is a requirement. This is both because is isn't specified as a requirement, but also because Hans Passant in a comment to my original question was very sure that the PIAs could specifically be used for developing without Office being installed, so it would not make sense to have Office as a prerequisite.

So does anyone have any idea why the Office 2007 PIAs do not install correctly, or what I could do to get closer to an answer? If you need more information, please let me know. Thanks.

Vigor answered 21/2, 2011 at 19:9 Comment(0)
C
15

I hit this a while ago, with a similar project. The PIA redistributable will only install the PIAs if Office is already installed on the machine (which kind of makes sense, but can be annoying when it comes to deployment)

Visual Studio should install the Office PIAs into a folder under it's own install directory - for example, on my machine I have a copy of all the PIAs under:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14

It's possible that these only get installed if you have Office on your machine at the time VS is installed, or perhaps there is an install option in the VS installer to install VSTO (Visual Studio Tools for Office).

If your problem is just related to getting a build working on the development machine that doesn't have Office, then you could try re-running the VS installer and see if you get an option to install VSTO, or try a google search and see if there is a separate VSTO download

Otherwise, I would just copy the PIAs from this folder to a similar location on the other Dev box.

Certitude answered 22/2, 2011 at 9:52 Comment(1)
Resolved. As it turned out, I already had the VSTO installed (It seems to have come automatically, at least with the full VS2010), and so I also had the Office PIAs at the path you mentioned. Apart from compiling without office, I would also like to be able to deploy to machines without office. I thought there would be a problem with referencing the outlook PIA just by browsing to it, since the path would be specific to my machine, but there was no problem, as one of the properties of the referenced component was to embed interop types into to the target assembly. Many thanks.Vigor
S
2

for the first point, I am 100% sure that GAC has been implemented to support versioning of the same assemblies, you can build an assembly called myCode.dll and register its version 1.0 to the GAC, then you build the version 1.1 and 2.0 and add both to the GAC, even if all of them have the same file name, GAC will keep both and every application will be able to use the proper version depending on the assembly binding information available, basically every application which holds a reference to the version 1.0 still gets it unless specified and is not affected by the presence of newer version.

Eventually when you list the presence of the Outlook PIA in the gac you see only the latest available version and not all of them but surely you should be able, somehow, to push another version in the GAC anyway.

Skyscape answered 21/2, 2011 at 20:37 Comment(1)
Yes. As I understand it, supporting multiple versions of a library is one of the main design goals of the gac. But this is my first time dealing with it so directly, so I just wanted to make sure that I wasn't missing something.Vigor

© 2022 - 2024 — McMap. All rights reserved.