Gosh Darn-it, just when something useful comes along you find it has a missing wheel. VSTO or more properly Visual Studio Tools for Office is a conceptually great idea to help make all the functionality of Office apps like Word or Excel usable as if they were native components in Visual Studio. So far, so good because the previous mechanism of using COM and COM shims was never very satisfactory or seamless.
Unfortunately, nothing comes without a downside and the first downside is that VSTO doesn’t support Office apps pre-version 11.0 (Office 2003). Ok, at first that seems workable since thats 4 years ago and surely people would have upgraded by now, until you discover that that has some big exceptions, proved by me identiying corporate customers still using Office 97 (on NT 4.0!).
The second gotcha is that VSTO is really very compatible between Office 11 and 12 (Office 2007), with 12 having shedloads more functionality and different interfaces, which becomes evident when you doscver that each version needs a different PIA (Primary Interop Assembly) which can’t be mixed.
This is a big downside for an ISV like me. So what can I do ? Well not much, apparently there are some bodges to get some common codebase but in reality we are left to write conditional code and essentially write two versions like this;
private void My_Addin(object sender, System.EventArgs e)
{
if (this.Application.Version == “11.0″)
{
// Office 2003-specific code.
}
else
{
// Office 2007-specific code.
}
}
This is inconvenient and there’s no guarantee (in fact far from it) that I won’t need a third condition for Office 14.0 next year (there’s no Office 13.0 for superstitious reasons). So how does this make me feel? it makes me feel we should just stick with COM shims because then we can support older versions, but then we lose new functionality like the Ribbon (or do it lower level) or stick with VSTO and make Office 12 our preferred target. No surprise which one MS want us to do! Gosh Darn-it, life is never easy.
