5
votes

I have Office 2007 on my dev machine. I have a small app I'm building for a customer server with Office 2003 that needs to do some interop. My program will run as a scheduled task in a nightly batch process.

No matter what I do, I can't find the version 11.0 of the Access interop assembly so that will work on the server.

I've tried explicitly downloading and installing them on my machine. I tried installing the 2007 interop assemblies on the server (a full Office 2007 install is out of the question). I tried several different COM references. I tried looking for the COM object on the server to reference in the visual studio project. And I've tried too many other little things to list them all here.

What's going on here? How can I get this working?

2
I assume you checked C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Access?Dirk Vollmar
I don't know about the environment you're programming in, but do you have to use early binding? Is there no form of late binding that you could use that would be Office version independent?David-W-Fenton
@Joel Was this ever solved? I'm having the same problem with ASP.NETJoe Phillips
@Joe Do not use office interop with asp.net. It doesn't scale at all and is almost always the worst possible way to do it.Joel Coehoorn
@Joel Makes sense. Thanks for the tip.Joe Phillips

2 Answers

1
votes

I've found the only way to do this, even with both versions installed side-by-side, in .Net v2 and above, was to add a reference to the PIA (rather than the COM lib). Frameork v1.1 would actually bind to the correct version, if they were present side-by-side.

0
votes

Can't you copy the PIA from the server to your machine (to a local folder) and then add a reference to that copy?

If you like to go another way you could avoid using the PIAs and use ComImport instead. Andrew Whitechapel has the details in his blog:

Add-ins for Multiple Office Versions without PIAs

Update (from comment): If you can't locate the Access PIA on the server you could try the following:

  • Download the Office 2003 PIA setup from here: Office 2003 Update: Redistributable Primary Interop Assemblies

  • Extract the self-extracting executable on the command line (/? will list the options):

    >O2003PIA.exe /C /T:C:\PIA
    
  • Run the extracted MSI with full logging enabled:

    >msiexec -i O2003PIA.msi /l*vx log.txt
    

    and check the log for the Access interop assembly and further hints whether anything went wrong with the installation. Alternatively to this step you could use an MSI unpacker utility to geth the assembly.