I'm writing an Excel Addin that should work in both 2007 and 2010. When I create a new project with Visual Studio I need to decide which version I want. I've chosen 2007 before, but since I have 2010 installed I can't debug it. I get an error:
You cannot debug or run this project, because the required version of the Microsft Office application is not installed.
It is my understanding that if I target 2007 I should be able to run it on both 2007 and 2010. Is that correct? If that's so, can I debug it using 2010?
A shared Add-in is made from a Visual Studio project creating a Com Add-In implementing the IDTExtensibility2 interface. This grants you access to the Excel model (workbooks, worksheets, Range, ...). This kind of project is still today what looks the most like a C# XLA. They are often used for formal commercial development deployed to external clients. While they are more difficult to make and maintain, they do give you deeper control over the Add-in and can be made somewhat version-agnostic (that is, you can use your own IA instead of a specific Office PIA library, and/or can do more in late binding to handle multiple Office versions with lower risks of compatibility problems).
here: http://metasharp.net/index.php?title=Csharp_and_Excel_Interoperability
You can go ahead by creating the addin for excel 2010. While you build the project you will get a patch file along with the add in. Users can install the patch before installing the add in on systems using excel 2007.
来源:https://stackoverflow.com/questions/4937891/excel-addin-that-works-on-excel-2007-and-2010