Re: Excel 2003 + 2007 on dev machine - deployment problems on Excel 2003 machine

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



What I did was have Office 2003 installed and upgraded (ie ran Office 2007 installer). This removed Office 2003.

I then started developing my application (actually part of a larger application), and realised when I came to the Excel part that most people (including the other developers building bits for this app) would be using Office 2003. At this point I installed Excel 2003 (as part of an Office 2003 install where I only installed Excel) alongside my Office 2007 install. No problems at all (except I've since noticed that the .xls files are registered to Excel 2003 now - but that's a minor thing).

Yes, both versions of the Excel PIAs are present - however, Excel 2007 (and all Office 2007 apps) installs with the PIAs some redirect assemblies which mean that when an application requests an Excel 11 PIA, they're redirected to Excel 12.

When I added a COM reference, I selected Excel 11. However, I noticed yesterday that actually the file this refers to in the Properties view of this reference is the 12 version. Hence anything I build will require Excel 12 installed.

Ideally the redirect I posted should be done in VS2005 (actually, ideally it VS2005 should by default ignore the redirect) as if you have explictitly requested Office 11 COM objects it shouldn't then use Office 12 ones. If it was done this way, then the application would be build for Office 2003, but when run on an Office 2007 machine, would work fine as the MS redirect assemblies would do their job.

The other solution that Walter Wang from MS suggested is to remove the Office 2007 PIAs from my machine, and only have the 2003 ones installed. At the moment, I have no need to specifically develop for Office 2007 apps, so this might be the best option, although I'm glad I found a work around.

Hope that helps,

David

Bill F wrote:
David:

This could be the answer to my woes.

I am curious...how is it that you have Office 2007 AND Excel 2003 installed on the same computer? I didn't think that was possible. Are both versions of Interop.Excel on your development computer, i.e. Version 11.0 and 12.0?

If I go back the system with Office 2007 installed (I saved an image before uninstalling Office 2007), I wonder if I can install Interop.Excel version 11.0 using the Office 2003 PIA installation O2003PIA.msi I downloaded from Micrsoft.

Bill

"David Hearn" <david.hearn@xxxxxxxxxxxxxxxx> wrote in message news:%23pWjnxVjHHA.1624@xxxxxxxxxxxxxxxxxxxxxxx
Correct, that's what I've done. When I try it on my dev machine (with the app.config and Office 2007 and Excel 2003 present) it works in just the same way it seems - so I'm not 100% sure if you need to worry about not deploying it to Office 2007 machines.

In my source folder and project I have an app.config file, when I build it, it creates a <executablename.exe>.config file in the bin\Release and bin\Debug folders containing the same information. It's that file (not the one called app.config) that I'm deploying.

Hope that helps,

David

Bill F wrote:
David:

So, let me see if I got this right. You build your application on a machine with Office 2007 installed. When you deploy the application to a machine with Office 2003, you include the app.config file you desribed below. When you deploy your application to a machine with Office 2007, you don't include the app.config because the redirect is not needed. Is this correct?

Getting Closer Bill
(maybe)

"David Hearn" <david.hearn@xxxxxxxxxxxxxxxx> wrote in message news:uSFDS9MjHHA.4596@xxxxxxxxxxxxxxxxxxxxxxx
From what I've been able to deduce, Office 2007 has redirects from Office 11 PIAs to Office 12 PIAs because they 12/2007 ones are backward compatible to 11/2003.

This means that whenever I add a reference to the Office 2003 Interop, I actually (without warning) get redirected to the Office 2007 Iterop files.

This causes a problem as when you build it, it references the Office 2007 ones, and deploying onto a Office 2003 machine - it doesn't have the Office 2007 ones.

Everything would be fine if my dev machine was Office 2003 and the depoyment machines were 2003 or 2007.

The solution it seems is in your app.config file redirect the request for v12 ones to v11.


<?xml version="1.0" encoding="utf-8" ?>
<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>
</configuration>

It's working for me with that as the main app.config file. The actual app doesn't use the Excel part, but a DLL it references does, and it seems that it's only the main app which needs this, not the DLL.

I'm also not sure whether this is a recommended way of doing it - but as I said, works for me.

Hope that helps you.

David


Bill F wrote:
I had the same issue. After some research and testing, I discovered that one cannot develop a .Net application for Excel on a development machine that has Office 2007 and have this application work on a computer that has Office 2003. However, your development machine can have Office 2003 and your application will work on machines with Office 2003 or Office 2007. Consequently, I had to go back to a development machine with Office 2003.

CAUTION: as you will see in my post that follows this message, when I uninstalled Office 2007 from my development machine and installed office 2003, I had big problems getting the application .exe to work. I'm still trying to resolve this.

Bill


"David Hearn" <david.hearn@xxxxxxxxxxxxxxxx> wrote in message news:%23ovnw7KjHHA.588@xxxxxxxxxxxxxxxxxxxxxxx
I'm writing a C# app which will populate an Excel spreadsheet. The app references Excel using COM.

I have Office 2007 on my machine, but the machine which will be running the application will have Office 2003. Therefore, when I added the Excel COM reference, I chose the Excel 11 one.

Now that I'm trying the application on another machine I'm getting errors saying that the Microsoft.Office.Interop.Excel version 12.0.0.0 is missing. Viewing the object browser I see that Microsoft.Office.Interop.Excel is described as:

Assembly Microsoft.Office.Interop.Excel
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll


This is strange condisering in the Solution Explorer view, I see the properties for the Excel Reference set to:
Microsoft.Office.Interop.Excel
Microsoft Excel 11.0 Object Library
C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll


It's saying it's Excel 11, but then references the Excel 12 interop libraries. I've removed the reference and added it again and it's still the same.

Any suggestions as to how I fix this? I need to keep Office 2007 on this machine, but need to be able to build for Excel 2003.

Thanks

David



.



Relevant Pages

  • Re: This worked for me.
    ... you must install a program ... I made sure add the folder name in TRUST LOCATION in both Excel and Word. ... Office Ultimate 2007 with SP1 installed ... Can you provide a link to a document showing the behavior (a zip with both the document and worksheet could be helpful). ...
    (microsoft.public.word.application.errors)
  • Re: VBA References - when is Office Object Library Reference set? Best practice re. Early/Late bind
    ... Microsoft MVP - Excel ... My code is set up with a reference to "MS Office 11.0 Object Library", and works fine. ... > If I set up my test system with Win2000/OfficeXP, and Office XP is set up to install everything on first use, then install my stuff, I find that the VBA will not compile, because the projects are still referencing the Office 11.0 object library and no reference has been set up to the Office 10.0 library. ... > Also, on Office XP installations that use the default installation options, the Office 10.0 reference is already there before I install my stuff and the correct reference is automagically used. ...
    (microsoft.public.excel.programming)
  • Re: Experience with 2003 & 2007 on same computer?
    ... each version of Excel uses its own set of registry keys. ... To find the correct path, open XL 2003, open VBA, CTRL G to ... Even if you install just Excel, ...
    (microsoft.public.excel.misc)
  • Re: Experience with 2003 & 2007 on same computer?
    ... each version of Excel uses its own set of registry keys. ... To find the correct path, open XL 2003, open VBA, CTRL G to ... 2007 if I install only Excel 2007? ...
    (microsoft.public.excel.misc)
  • Re: OLE problem? Cannot insert table into excel cont...
    ... It sounds as though some of the Registry setting in Office are pointing to the wrong application. ... Especially if you install an earlier version after a later version. ... I go to insert/table/excel spreadsheet, it will then work but if I close out ... It is like word is trying to open excel 03 through dde or whatever ...
    (microsoft.public.word.application.errors)