Excel 2003 using 2007 PIA's !

G

Gary Dunne

Sorry for the double posting.. I accidentally buried this question inside
another topic

----

Hi ... I have developed an application that targets Excel 2003 (using VS
2005), however on the development PC I have both Excel 2003 and 2007
installed. Even though I am explicitly referencing the Excel 11 object
library it uses the 2007 PIAs.

The problem arises then when I roll out to a machine that has only Office
2003 installed (99% of the target PCs).
In order to install the 2007 PIAs (using the redistributable
http://www.microsoft.com/downloads/...aa-bed4-4282-a28c-b864d8bfa513&displaylang=en)
the minimum requirement is that at least one office 2007 application is
installed.

This is obviously a deal breaker for my app since I can't require the client
to have to upgrade to Office 2007.

Does anyone know of a way around this behaviour ?

Thanks

Gary
 
G

Gary Dunne

The answer.... For anyone that has a similar problem.

You can manually edit the policy file at
C:\windows\assembly\GAC\Policy.11.0.Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Policy.11.0.Microsoft.Office.Interop.Excel.config
change the value of newVersion to "11.0.0.0"

or, take the cleaner option which is...

Open the ".Net framework 2.0 Configuration" tool from Administrative Tools

Right click on Configured Assemblies and select the "Add..." menu
In the list find Microsoft.Office.Interop.Excel
Go to the Binding Policy tab and enter 11.0.0.0 for both Requested Version
and New Version

Repeat for "Policy.11.0.Microsoft.Office.Interop.Excel" and any other office
libraries used by your app

Job done ...

Gary
 
G

Gary Dunne

and there's more ! .. you could also save all that hassle and just put the
following into your app.config file

<configuration>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="Microsoft.Office.Interop.Excel"
publicKeyToken="71e9bce111e9429c" culture="neutral" />

<publisherPolicy apply="yes" />

<bindingRedirect oldVersion="12.0.0.0"
newVersion="11.0.0.0"/>

</dependentAssembly>

</assemblyBinding>

</runtime>

....
 
G

Guest

Hi Gary,
<bindingRedirect oldVersion="12.0.0.0"
newVersion="11.0.0.0"/>

this is not supported from Microsoft as you
know from other threads, but works in 90% of
the cases, in some cases crashes.
Good practice is, to implement against the 11.0
PIAs in your case.

The opposite way with bindingRedirect from
11.0 to 12.0 is supported (and standard).


ciao Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top