6
votes

We need to create a VSTO add-in in C# that supports both Outlook 2007 and 2010.

To start off we created 3 projects:

  1. File->New Project->Office->2007->Outlook 2007 Add-in
  2. File->New Project->Office->2010->Outlook 2010 Add-in
  3. File->New Project->Windows->Class library

All shared code is in project #3.

So far, we have partially developed the add-in and have been using ClickOnce deployments for testing.

One day, we noticed someone installed the 2010 add-in for 2007 Outlook and had no ill effects whatsoever.

So a few questions:

  • Is there any reason to create the 2007 VSTO project? Can we just create the 2010 project?
  • Or is the only difference the version of the office runtime that is bootstrapped by the ClickOnce installer? Can you just install the 2010 runtime for Outlook 2007?
  • If there is no difference, why are there two Visual Studio project templates?

In our final solution, we will be using a WiX installer, which is also working thus far. The WiX installer will be simplified greatly if we can use 1 project for the add-in.

1

1 Answers

6
votes

Is there any reason to create the 2007 VSTO project? Can we just create the 2010 project?
You can just use the 2010 project, but if you accidentally reference any 2010 ONLY api's, for example accessing any of the new conversation API's will cause your add-in to blow up in 2007.

Or is the only difference the version of the office runtime that is bootstrapped by the ClickOnce installer? Can you just install the 2010 runtime for Outlook 2007?
Basically you are writing a VSTO 3.0 add-in, which works for both 2007 and 2010. VSTO doesn't actually care which template you are writing for, only that your add-in is a VSTO 3.0 add-in.

If there is no difference, why are there two Visual Studio project templates?
2 reasons that I can see, F5 debugging support, and to make sure you do not access a new API'

If you do go down the only 2010 add-in road, I suggest you do a compile of the solution against the Microsoft.Office.Interop.Outlook v12 PIA which will show you any new API's that you are accessing. If you do want to target some of these new API's only IF your add-in is hosted in 2010 then have a look at http://blogs.msdn.com/b/vsto/archive/2010/06/04/creating-an-add-in-for-office-2007-and-office-2010-that-quot-lights-up-quot-on-office-2010-mclean-schofield.aspx