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 appreciated - I can't seem to find anything on google that specifically addresses this question.
I am developing a C# excel add-in using Visual Studio 2010.
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 :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With