Can an excel VSTO add-in be compatible with excel 2007 and 2010?

后端 未结 1 1957
鱼传尺愫
鱼传尺愫 2021-02-03 15:21

Is it possible to develop an excel add-in using VSTO that can be deployed to both excel 2007 and 2010?

Any links to a detailed resource on this topic would also be appre

相关标签:
1条回答
  • 2021-02-03 16:11

    I already answered this for Word, but it also applies to Excel:

    If you want to deploy to Office 2010 AND 2007, you have to add references to the v12.0 assemblies (Microsoft.Office.Interop.Excel and Office).

    Now there is still the problem that your addin will require the 2007 PIA, but they won't install if you only have Office 2010 on the target machine (because they have Office 2007 as a prerequisite). To solve this you have to set Embed Interop Assemblies = true for those two dlls (in the reference properties) and use dynamic for the types you can't directly reference anymore.

    This causes some "weirdness" with Intellisense not finding methods etc., but it should not be a big problem -at least now PIA are not required anymore and your addin will deploy on both 2007 and 2010 (you'll have to take care of the installer as well, but that is a whole other story).

    It's a bit of a mess, but if you are working with VSTO I suppose you are used to this kind of stuff :-)

    0 讨论(0)
提交回复
热议问题