Developing an add-in for multiple versions of Office (Mary Lee)

Rate This
  • Comments 10

Theoretically, you can develop an add-in for multiple versions of Microsoft Office by catering to the lowest common denominator. This means if you use an Excel 2003 add-in template in Visual Studio 2008, you would be able to develop and debug this with Excel 2007. However if you try this, you may meet these error messages: "You cannot debug or run this project, because the required version of the Microsoft Office application is not installed.", followed by "Unable to start debugging."

You can develop an Office 2003 add-in but use the 2007 Microsoft Office system for debugging. The following procedure demonstrates how to update your Visual Studio debugging options to use Microsoft Excel 2007 to debug an add-in targetting Microsoft Excel 2003.

1. On the Project menu, click on ProjectName Properties.

2. Click on the Debug tab.

3. In the Start Action pane, click the Start external program radio button.

4. Click the file browser button and navigate to %ProgramFiles%\Microsoft Office\Office12.

5. Choose Excel.exe and click Open.

6. Press F5 to debug your add-in.

This procedure works because the .NET Framework runtime loads the 2007 Microsoft Office version of the primary interop assembly, even though the add-in was developed with the Microsoft Office 2003 PIA. For more information, see Office Primary Interop Assemblies.

Before you use a Microsoft Office 2003 template, consider the impact on your project. Because you created your project with an Excel 2003 add-in template, you can now develop with the .NET Framework 2.0. However, this means that you cannot use new features in Visual Studio 2008 that depend on .NET Framework 3.5.

For additional information, see Andrew Whitechapel's blog entry Can you build one add-in for multiple versions of Office? and the MSDN Library documentation Creating Solutions for Multiple Versions of Microsoft Office.

Mary Lee, programming writer.

Leave a Comment
  • Please add 7 and 1 and type the answer here:
  • Post
  • I am having problems consuming a web service from Access2003. I can not find a complex type property from a method

  • Over the past few weeks, I've attended and presented at a number of conferences (specifically VSLive,

  • One of the common questions I get asked when I do sessions on VSTO / OBA development is "how can

  • I've a 2003 excel add-in referencing the office 11.0 dll. I want to implement the IribbonExtensibilty and customise the ribbon for office 2007.

    I tried creating a separate dll for the ribbon refferencing the office 12.0 dll and added this dll to my 2003 addin. It gives me the below error

    "Assembly 'CustomRibbon,Version=12.0.0.0' which has a higher version than referenced assembly 'office, Version=11.0.0.0 ' "

    please suggest a solution.

  • Aziz - you should read my blog post (which Mary's post does refer to) - this explains what the problem is, and a possible workaround: http://blogs.msdn.com/andreww/archive/2007/06/15/can-you-build-one-add-in-for-multiple-versions-of-office.aspx

  • Hi Andrew!

    I did read your blog.

    I added the reference of office 12.0 to the 2003 add-in. It builds perfectly fine .

    It worked for machine having office 2007 however failed on a machine having only office 2003 as explained by you in the blog.

    Is there any work around for this addin to work with office 2003 also?

  • Hi Andrew!

    I did read your blog.

    I added the reference of office 12.0 to the 2003 add-in. It builds perfectly fine .

    It worked for machine having office 2007 however failed on a machine having only office 2003 as explained by you in the blog.

    Is there any work around for this addin to work with office 2003 also?

  • Great, works for Office 2010 as well

  • To Aziz:

    How did you get ribbon working in excel 2007?

    Do you use WPF ribbon or RibbonX (xml)?

    What are cons and pros of the two ways?

    thanks

  • Thank you very very very much. it solved my problem from several days :)

Page 1 of 1 (10 items)

Developing an add-in for multiple versions of Office (Mary Lee)