After chatting with a few people about Visual Studio Tools for Office (VSTO) recently, it’s clear that the technology is not that well understood (even though, in my opinion, Microsoft have done a pretty good job of articulating it – much better than say OBA for example). So in this post I’m aiming to give a high level overview of VSTO and clear up some misconceptions.
As usual this is covered under my ‘well duh’ disclaimer, and I apologise in advance for ‘reworking’ some of my content from earlier in the year, including this one from January and my general VSTO page. For a comparison of VSTO to VSTA see this page.
VSTO – What?
VSTO is Microsoft’s tool set for building applications that run on Microsoft Office (eg Word, Excel, Outlook, PowerPoint).
I deliberately choose the word ‘on’ because part of understanding VSTO is to view Office as a platform.
VSTO – A brief history…
Originally a replacement for VBA (Visual Basic for Applications) that was delivered in Excel and Word, VSTO was made available in its first version approximately around the start of 2004, targeting the Office 2003 platform. Development was performed in Visual Studio 2003 but was referred to as VSTO 2003 (or sometimes VSTO 1.0). It was an add-on to VS.NET 2003 and wasn’t free (costing around $450).
The second version, referred to as V2 or VSTO 2005 was a big update that added numerous advances and enhancements (eg support for Outlook). It was delivered as a special SKU of VS 2005 (my understanding is it was not available as a separate download, but I could be wrong).
The third version, confusingly titled VSTO 2005 Second Edition (VSTO 2005 SE) was delivered in 2007 and focused on targeting the Office 2007 platform. It was a freely downloadable add-on for VS 2005.
This SE version was tweaked significantly and released in November 2007 as part of Visual Studio 2008 (Professional and above – it is not available in the Standard edition), and is referred to as VSTO V3 (even though it is the fourth version of the product). VSTO 2008 overcomes many of the deployment and security hurdles found in previous versions, and adds a number of design helpers (eg visual editing of Office 2007 toolbars, support for SharePoint 3.0 Workflow, etc). SP1 for VSTO V3 is to be released shortly and further improves deployment abilities (as well as bug fixes, enhancement, etc).[The reason the version numbers are confusing is because in Vx terms they refer to the runtime used, not so much the tooling released. So, technically speaking VSTO 2005 and VSTO 2005 SE both use the same V2 runtime. VSTO in Visual Studio 2008 is using V3 of the runtime, even though it is the fourth release of the product. For more information Andrew Whitechapel has a excellent overview.]
The aim of VSTO is to provide tools for developers to build on top of Office as a platform. Using VB.NET and/or C#, developers can use Visual Studio to build add-ins for most of the Office 2003 and 2007 applications, including Word, Excel, Outlook, PowerPoint, InfoPath and Visio. SharePoint and Groove development is also possible, although not directly targeted.
VSTO – How?
So, how to get working with VSTO?
In a nutshell VSTO is a set of Visual Studio project templates that allow you to write add-ins for Microsoft Office applications (eg an add-in for Outlook, or Word, etc).
(Don’t worry) I’m not going into any code in this post, but I think screen shot from File –> New –> Project… in Visual Studio 2008 helps explain the scope:
As a developer you can build add-ins for most of the Office programs. Start by choosing a particular template (eg an Outlook 2007 Add-in) and Visual Studio will setup the skeleton and initial hooks.
Application level versus Document level
VSTO supports four types of add-in. The two main ones are:
- Application level add-ins – are those that reside in the program itself. Example: you add a toolbar in Word that has functionality that can run regardless of which document you have open. Application level add-ins can be written for just about all Office apps including Outlook, Word, Excel, PowerPoint, Project and Visio (all in both 2003 and 2007 versions) and InfoPath 2007.
- Document level add-ins (or customisations) – are delivered within a specific document. Example: you include functions in a specific Excel workbook. The functions are only available when you open that workbook. Document level add-ins are only relevant to Word and Excel. (You could think of Document level customisations as the VSTO equivalent of VBA macros in Word and Excel).
VSTO also support two lesser known types:
- SharePoint 2007 Workflow templates
- InfoPath 2007 Form Templates
VSTO – Some misconceptions
There’s a few common misconceptions I’ve come across talking with people about VSTO. Here’s the clarifications:
- Yes, VSTO V3 requires Visual Studio 2008 and the .NET Framework 3.5 – I mention this because it is a common question on the forums. So, if you don’t have Visual Studio 2008, or can’t be certain your users will have .NET 3.5 then you’ll need to work with a previous version.
- Yes, you can target both Office 2003 and Office 2007 apps using VSTO V3, but no, you can’t target them both in the same add-in (eg you can’t write a single add-in that will work in both Outlook 2003 and Outlook 2007).
- Yes, VSTO and VBA are friends. Whilst VSTO may have started out as a replacement for VBA, it soon became apparent that Interop with VBA is much better for all concerned. VBA is going to be around for a while, and with interop the huge body of VBA code can be used in VSTO apps (see this post for more VBA and VSTO details).
- Yes, VSTO is a part of OBA – you may run into the term Office Business Applications (OBA) and think OBA and VSTO are synonymous. But that’d be missing the huge scope of OBA. OBA covers a whole enterprise architecture with LOB apps and Servers as well as Office. VSTO is just part of the tooling for building OBAs (see here for a full overview of OBA).
VSTO – Why?
Question: Why exactly would you want to consider VSTO?
Answer: so you can build on a platform.
And not just any platform. But a platform that is now in its twelfth version, covers almost every imaginable business and home user scenario, and is installed on more 500M PCs worldwide… The Office platform.
Now, to be fair, not all of those users are using Visual Studio 2003 or 2007, but the majority certainly are, and growing. (For example, in a recent OBA webcast I watched, around the 3:09 mark there were figures from Forester Research – dated 31 Mar 2008 – detailing that 62% of surveyed enterprises not yet on Office 2007 were moving to Office 2007 in the next 12 months.)
So then the question becomes – why build on a platform? I think Andrew Coates answered this beautifully in his Standing on the Shoulders of Giants post a year ago. If you haven’t already, read it. [Aside: Initially, you’ll wonder why he goes into such detailed history… but later, perhaps pondering it while stuck in line at the local supermarket, or caught in a boring meeting, it’ll suddenly fall into place, and you’ll understand the necessity of working with a platform.]
With VSTO, you get to build on top of the Office platform, using the vast functionality of the .NET framework.
VSTO – Hurdles
VSTO isn’t without its problems. For one, you’ve got a whole lot of extra weight you need to ship with your app (including a bunch of extra DLLs called Primary Interop Assemblies – I’ll be explaining those things in a later post – plus the VSTO runtime, and of course the .NET Framework). But that isn’t the main thing…
Deployment has been the biggest hurdle to VSTO adoption. Getting your add-in out there and easy to install isn’t the simple task it should be. V3 has certainly improved the process, but there’s still work to be done. And as mentioned in an earlier post, a big focus of the upcoming VS2008 SP1 enhancements has been to make VSTO deployment even easier. Andrew Coates links to a number of good resources on VSTO deployment.[Assuming those issues are resolved shortly, there is really only one further hurdle: mindset. I’ve mentioned this previously, and I think it still stands, but since it isn’t really to do with understanding VSTO itself I won’t go into details here.]
VSTO – Where are the examples?
One of the frustrations I’ve found with VSTO is finding some good real-world examples. Sure, there’s plenty of code samples, and the odd Code Gallery post, but there’s nothing detailing commercial applications that I can find (I’m hoping someone corrects me on this). There’s nothing on the Microsoft case studies site (the closest I could find were some OBA case studies that mention VSTO), and there’s nothing in any blogs that I can find pointing to cool VSTO apps available for download.
That’s not to say there aren’t plenty of add-ins for Outlook, Word, Excel, etc out there, it’s just that I can’t be certain if they were built using VSTO or not. For example, Xobni is a nice little Outlook add-in, but doesn’t appear to use VSTO. Hopefully I can add some examples to this section soon.
VSTO – Resources
I’ll be linking to a full list of VSTO resources in a future post, but for now start here: VSTO Portal on MSDN. Then go here for a Getting Started with VSTO guide. For hands on detail, take a look at this helpful forum post by the awesome Cindy Meister and these How Do I Videos on the Office Dev Center. For blogs and articles head over to OfficeZealot and of course the official VSTO blog. I’ve also listed some other resources on my VSTO page.
Also, if you’re interested I have a separate feed for my VSTO related posts: VSTO
VSTO – Summary
- Visual Studio Tools for Office is a set of Visual Studio project templates and runtimes for building add-ins for Microsoft Office programs.
- VSTO is mature (now in its fourth version) and easy to use. It has overcome many of the deployment hurdles it had in the past, but still has a few to resolve.
- The latest version uses Visual Studio 2008 and the .NET Framework 3.5 and can create add-ins for just about any Office 2003 or Office 2007 app.