Building Outlook addins (compatibility office 2003 and 2007; Primary Interop Assemblies (PIA) are missing)
- Hi,
I'm working on an Outlook-addin (C#, FormRegions, VSTO 2005 SE).
I've made some steps and recently I tried to incorporate my Outlook addin in our built system. But unfortunately there isn't installed any MS Office and in the Visual Studio I can see some unresolved references (Office.dll, Microsoft.Office.Interop.Outlook.dll, Microsoft.Vbe.Interop.Forms.dll , Mscomctl.dll). All these assemblies are part of the Office Primary Interop Assemblies (PIA). I found a redistributable package, but I couldn't install it, because this package requires an installed MS Office.
I don't need to execute my addin on the build computer, I only want to compile it. So I put in the real references by path and my solution compiled successfully (maybe the compiler needs the assemblies only for type info). Can somebody imagine disadvantages of this procedure?
And last but not least, this issue has lead to an important question: As VSTO2005SE addins are supposed to run with MS Office 2007 and 2003, so what is the recommend strategy to build them? Is there compatibility? Can I build my addin with either of the MS Office versions and expect that it works properly (at least) with version 2003 and 2007? Or do I have to prepare 2 computers with different MS Office versions and distribute different install packages of my addin???
Thanks, Raul
Answers
Hi Raul,
VSTO does not support to build one solution that target at both Office 2003 and Office 2007. As KB 840585 point out, (http://support.microsoft.com/kb/840585)
“The Office 2003 managed code add-ins must be built against the Office 2003 PIAs. The Office 2007 managed code add-ins must be built against the Office 2007 PIAs. Therefore, if you build an add-in solution that you intend to use with several versions of Office, Microsoft recommends that you build a version of your add-in for each version of Office that you intend to support.”
And the following article written by Andrew Whitechapel may be what interests you about all the questions.
Thanks
Ji
Hi David,
That is right! Solutions developed under Office 2003 should continue to run with Office 2007. This is also why Andrew suggest in the article: “First, you need to target the lowest common denominator (Office 2003 in this case), and then write conditional code to use version-specific functionality dependent on which version you're actually running in.”
But this does not mean Outlook 2007 Add in will always work in Outlook 2003. What will happen, when your customization involve some new specific features of Outlook 2007, as you mentioned above, the ribbon. In fact, there are many new features and modification in Outlook 2007 Object Model, like PropertyAccessor, FormRegion, ExchangeUser and so on.
No doubt that Add in will throw exception if your codes involve these property, but be executed on Outlook 2003.
Thanks
Ji
All Replies
Hi Raul,
VSTO does not support to build one solution that target at both Office 2003 and Office 2007. As KB 840585 point out, (http://support.microsoft.com/kb/840585)
“The Office 2003 managed code add-ins must be built against the Office 2003 PIAs. The Office 2007 managed code add-ins must be built against the Office 2007 PIAs. Therefore, if you build an add-in solution that you intend to use with several versions of Office, Microsoft recommends that you build a version of your add-in for each version of Office that you intend to support.”
And the following article written by Andrew Whitechapel may be what interests you about all the questions.
Thanks
Ji
Hi,
I developed an addin for Outlook 2007 with VSTO 2005 SE and I had the good surprise to see that it was working pretty well with outlook 2003. (expect some functions like for the ribbon extension ). Now after few tests, like Andrew Whitechapel is talking about in his article. I think my addin is compatible with both version of Outlook.
On this article ( http://msdn2.microsoft.com/en-us/library/bb332051.aspx ), we can read :
"If you are deploying an Office 2003 solution to be installed on computers that have either the 2003 or the 2007 release of Office, you can include both redistributable packages."And here ( http://msdn2.microsoft.com/en-us/office/aa905543.aspx ) :
“VSTO 2005 SE ensures that the applications customers have built on Office 2003 with VSTO 2005 continue to run with 2007 Office system.”
So, Am I really wrong to let use my addin, built with 2007 PIA, to users with Outlook 2003?
What can happen to those users with Outlook 2003?David
Hi David,
That is right! Solutions developed under Office 2003 should continue to run with Office 2007. This is also why Andrew suggest in the article: “First, you need to target the lowest common denominator (Office 2003 in this case), and then write conditional code to use version-specific functionality dependent on which version you're actually running in.”
But this does not mean Outlook 2007 Add in will always work in Outlook 2003. What will happen, when your customization involve some new specific features of Outlook 2007, as you mentioned above, the ribbon. In fact, there are many new features and modification in Outlook 2007 Object Model, like PropertyAccessor, FormRegion, ExchangeUser and so on.
No doubt that Add in will throw exception if your codes involve these property, but be executed on Outlook 2003.
Thanks
Ji
You're right Ji,
thanks you for this precision ;-)- Many thanks, it isn't that easy as I hoped, but at least I gained some insight. Raul

