Office Interop issues between 2003 and 2007

M

Matt M

SO, I have a unique issue in regards to the interops. I have an application
that interfaces with several different types of email clients, OLK2003 being
one of them. I've recently added the new OLK2007 to my application and
applied a fix to my app config that allows OLK2003 to use the OLK2007
interops to everything compiles. However, when the application is launched in
a situation where it's running in an office 2003 environment it breaks
because it's looking for the office 2007 interops.

What I need help with is to find a way to get both versions of outlook to
compile in my solution (the code lives in two different projects) and
operate accordingly. The 2003 code will never need to run in the 2007
environment and visa versa.

Any assistance would be appreciated.
 
K

Ken Slovak - [MVP - Outlook]

Since you can only have 1 version of Outlook installed on a computer you are
best off using 2 development machines, one with each version installed. Then
compile from wherever you need to for support for that version of Outlook.

I do that using different virtual machines. If nothing I'm doing requires
the Outlook 2007 object library then the Outlook 2003 code should run
unchanged on Outlook 2007.
 
M

Matt M

Actually you can have the two versions on the same computer. You just may not
be able to use one of the two. In this case I have a copy of OLK 2007 and
2003 installed. 2003 doesn't work but that's ok, all I need are the interopts
and I can do my testing on a VM.

Anyway, is it possible to force VS to use the 2003 interopts if the 2007
interopts are present? I'm trying to use assemblyBinding and bindingRedirect
but it doesn't appear to be getting evaluated . . .
 
K

Ken Slovak - [MVP - Outlook]

I've never tried it but you might be able to remove the reference to Outlook
2007 and add a reference to Outlook 2003. But I think in .NET code that
would screw up the referencing to the Office 2003 or 2007 PIA.

In VB 6 code I've successfully used a reference to the Office 2007 and
Outlook 2000 tlb's and compiled addins that run on Outlook 2000 - 2007 and
that can handle the ribbon, but .NET code is much pickier when it comes to
that.
 
M

Matt M

Yeah, I tried that earlier today and what ends up happening is the
Microsoft.Office.Core interop notices there is a new version and changes the
version used, despite strong naming.

What I'm going to try next, and it should work, is to uninstall 2007 and
develop it all in 2003. Since 2007 is backwards compatible and I'm not using
any new or fancy features it might work. I'll keep you posted.
 
K

Ken Slovak - [MVP - Outlook]

Developing it all on an Outlook 2003 machine will definitely work. I've done
that with VSTO addins using C# and VB.NET and with shared addins in both
languages.

This sort of thing, plus the need to support versions as early as Outlook
2000 in one addin plus the ribbon, is why I still develop the vast majority
of my commercial addins using VB 6.

BTW, take a look at Dennis Walletin's blog at http://xldennis.wordpress.com/
and look at the December 12 entry on Creating a standalone type library for
IRibbonExtensibility. It would let you work with the ribbon for Inspectors
in Outlook 2007
 
C

Cindy M.

Hi Matt (Ken),
Yeah, I tried that earlier today and what ends up happening is the
Microsoft.Office.Core interop notices there is a new version and changes the
version used, despite strong naming.
There have been a couple of discussions on this topic in the VSTO forum. You
might find the information here interesting

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1152924&SiteID=1

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
M

Merlin

I have similar problems: After installing Office 2007 on the development
machine, the Office 2003 PIAs are not available any more. Most of the work I
do is on Office 2007, but some projects have to be recompiled for bug fixes
with the 2003 PIAs. As I need to digitally sign Click-Once deployments, using
an Office 2007 virtual machine does not work (no USB support for the card
reader on VMs!).

So the task is in fact simple, but I have not found a solution yet:

1) Is it possible to compile a project against the Office 2007 PIAs on the
development machine but to bind to version 11 (2003) PIAs?

2) Can I reference the Office 2003 PIAs in any way on the 2007 machine or is
it possible to install the PIAs (just for compiling purposes) without having
Office 2003 on the development machine?

3) Is there a tweak to just install the Office 2003 PIAs (without installing
Office 2003) on the Office 2007 machine, without breaking the 2007 PIAs in
the GAC?

4) Alternatively: Is is possible to compile the Click-Once deployment
project on the VM with Office 2003 (without access to the digital
certificate), but to sign and deploy the project on the host system with
Office 2007 (without any need to have the 2003 PIAs installed)?

Thank you in advance for any hints!
 
C

Cindy M.

Hi =?Utf-8?B?TWVybGlu?=,
I have similar problems: After installing Office 2007 on the development
machine, the Office 2003 PIAs are not available any more. Most of the work I
do is on Office 2007, but some projects have to be recompiled for bug fixes
with the 2003 PIAs. As I need to digitally sign Click-Once deployments, using
an Office 2007 virtual machine does not work (no USB support for the card
reader on VMs!).

So the task is in fact simple, but I have not found a solution yet:

1) Is it possible to compile a project against the Office 2007 PIAs on the
development machine but to bind to version 11 (2003) PIAs?
No. The design of Office and VS pretty much precludes that possibility. If you
can't use a virtual machine, then you'll need a second development machine.
2) Can I reference the Office 2003 PIAs in any way on the 2007 machine or is
it possible to install the PIAs (just for compiling purposes) without having
Office 2003 on the development machine?
Best you could do would be to use TlbImp.exe to create a set of IAs. But these
would have to be distributed as part of your solution; your solution couldn't
reference the PIAs on the client machine.
3) Is there a tweak to just install the Office 2003 PIAs (without installing
Office 2003) on the Office 2007 machine, without breaking the 2007 PIAs in
the GAC?
No.

4) Alternatively: Is is possible to compile the Click-Once deployment
project on the VM with Office 2003 (without access to the digital
certificate), but to sign and deploy the project on the host system with
Office 2007 (without any need to have the 2003 PIAs installed)?
There is such a thing as delayed signing, but I don't know the details of how it
works. You might look into that.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
P

Patrick Schmid [MVP]

I have had some success compiling a VS project with the 2007 PIAs,
deploying it with those and then running it in 2003. It might be worth a
try to look into that.

Patrick Schmid [OneNote MVP]
--------------
http://pschmid.net
***
Office 2007 RTM Issues: http://pschmid.net/blog/2006/11/13/80
***
Customize Office 2007: http://pschmid.net/office2007/customize
RibbonCustomizer Add-In: http://pschmid.net/office2007/ribboncustomizer
OneNote 2007: http://pschmid.net/office2007/onenote
***
Subscribe to my Office 2007 blog: http://pschmid.net/blog/feed
 

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