Features in AH Releases

The main difference between VSTO and VSTO 2005 SE is that the latter contains application-level add-in support for Office (2003 and 2007) applications; there is no document-level customization support in VSTO

Figure 14.1. The Ribbon in PowerPoint

2005 SE (except for support for managed code behind InfoPath 2007 forms).

❖ Note You cannot simultaneously develop VSTO solutions for the 2003 and 2007 releases of Office. Side-by-side installations of these applications are not supported in a development environment.

Table 14.1 shows the differences between the VSTO features and those of VSTO 2005 SE. This table doesn't represent a comprehensive feature list for VSTO 2005 SE. However, it gives you a general idea of what you can expect from VSTO 2005 SE.

❖ Note If you've installed VSTO 2005 SE on a version of Visual Studio 2005 that doesn't contain VSTO, you will have only the functionality listed in the VSTO 2005 SE column. If you've installed it on top of VSTO, you will have the features listed in both columns.

Table 14.1. Features of VSTO




Managed code extensions for Office 2003 (Word, Excel, InfoPath)


Actions pane for Office 2003


Smart tags for Office 2003


Document designer for data-bindable Windows Forms controls and host controls


InfoPath 2007 Forms


Add-in Support

Outlook 2003


✓ ✓

Outlook 2007


Word 2003


Word 2007


Excel 2003


Excel 2007


InfoPath 2007


PowerPoint 2003


PowerPoint 2007


Visio 2003


Visio 2007




Custom task pane


Outlook form region


Here's an easy way to understand which edition of VSTO to use with Office. If you want to develop solutions for Office 2003, use VSTO for document-level customizations and VSTO 2005 SE for add-ins. If you want to develop solutions for the 2007 release of Office, use VSTO 2005 SE. Note that VSTO 2005 SE does not support document-level customization for either the 2003 or the 2007 release of Office, with one exception: InfoPath 2007 Forms.

VSTO 2005 SE Add-in Model

VSTO 2005 SE provides safe loading, unloading, and management of add-ins created with managed code (Visual Basic and C#). The architecture of VSTO 2005 SE add-ins described here is identical for all the supported Office (2003 and 2007) applications but differs from add-in development of Outlook 2003 with the full version of VSTO. If you create a new project using VSTO 2005 SE, you'll see the six supported add-ins in the 2007 Add-ins node, as shown in Figure 14.2, as well as five supported add-ins in the 2003 Add-ins node.

Figure 14.2. The ThisAddin class

As with VSTO add-ins, VSTO 2005 SE add-ins provide application domain isolation for each add-in that is loaded, but a different architecture is employed in VSTO 2005 SE add-ins. When you create a new VSTO 2005 SE add-in, you'll notice that a ThisAddin (not ThisApplication) code file and class are generated. The Application object in VSTO 2005 SE add-ins is not wrapped; you will no longer find the Microsoft.Office.Tools.Outlook.Application namespace. Instead, VSTO 2005 SE add-ins reference the Interop Application object (Microsoft.Office.Interop.Outlook.Application).

So the main difference in writing code for a VSTO 2005 SE add-in is that you access the Application object through the ThisAddin class. For example, if you want to display the version of the application in a message box you no longer write


Instead, you write


As shown in Figure 14.3, the ThisAddin class exposes a Shutdown and a Startup event and creates the event handlers, maintaining its consistency with VSTO add-ins and document-level customization projects. Even though the Application object is not wrapped, the add-in is strongly typed.

All VSTO 2005 SE add-ins follow this same pattern; however, in Excel add-ins, VSTO 2005 SE generates initialization code that wraps the Application object in the transparent proxy class, as shown in Figure 14.4. This class fixes the Excel locale issue described in Chapter 7.

Office 2007 provides a new interface for add-ins that displays specific information about the add-ins you have loaded. Any loaded shared add-in is referenced by mscoree.dll, whereas VSTO 2005 SE add-ins refer-

96 WordAddlnl Microsoft Visual Studio



Edit View Project Build Debug Data Tools Window




~ ~ 13 H 0 1 * 3a a 1 *) - c - m - % I ►


- Any CPU - L®

B n-j


ThisAddln.vb f File System (WordAddlnl Setup) Start Page


§i;l # si i m ^


-f (ThisAddin Events)


Startup jJ


Q Solution "WordAddlnl'


□ public class ThisAddin


- jj WordAddlnl i 0... jj^ word


n Private Sub ThisAddin Startup(ByVal s


lender As

Object, ByVal e As System.EventArgs> Handles Hi

M My Project _

End Sub

&■• Gjj- WordAddlnl Setup 1=1 • S Detected Depen>


[] Private Sub ThisAddIn_Shutdown[ByVal

sender As Object, ByVal e As System.EventArgs) Handles 1

i' i* r.. J

End Sub

Solution Ex... |B}Cl»S,„-

L End class

Properties - » x

ThisAddin Startup Attribu -

Figure 14.3. The ThisAddin class for Word

Figure 14.4. The ThisAddin class

ence the path to the manifest for the add-in, as shown in Figure 14.5. This reference enables you to easily identify add-ins. What's more, only a specific add-in that causes problems need be disabled.

VSTO add-ins are loaded by AddinLoader.dll and act as a shim between the add-in and the Outlook application. Because Office 2003 shipped before VSTO, it is not aware of the AddinLoader.dll file. As described in Chapter 11, VSTO add-ins require registry entries that specify the

Figure 14.5. Add-in interface

ManifestLocation and the ManifestName. With VSTO 2005 SE add-ins, on the other hand, these registry keys are combined into one entry named Manifest. Also, the COM-specific registration is now omitted. There is no ProgId or CLSID registration under HKEY_CLASSES_ROOT, resulting in faster startup time for VSTO 2005 SE add-ins.

VSTO 2005 SE adds a new bootstrapper component, VSTOEE.dll, to the VSTO runtime. When Office sees the Manifest entry in the registry, it loads VSTOEE.dll, which then loads the proper version of the Addin-Loader.dll to load the add-in. The location of the add-in assembly is then listed in the new Add-in interface of Office 2007.

Because detailed information about the add-in is known, Office can limit hard-disabling to a specific, badly behaving add-in rather than disable the entire VSTO loader and thereby add all VSTO add-ins to the Exclusion list. As a result, VSTO 2005 SE add-ins are much more stable than VSTO add-ins or managed shared add-ins.

Figure 14.6 shows an example of a disabled add-in. In VSTO add-ins for Outlook 2003, an add-in can be disabled whenever an error occurs during startup. With VSTO 2005 SE, errors that occur in startup do not disable the add-in because the event sequencing in VSTO 2005 SE is different from that in VSTO add-ins.


' ¿g View and manage Offke add-ins,








Aarane* <1

nctivr- ApptKalnn Add int

E»«i Visual stuü.Q Design Tim+ Adaptor Ajja.fi

COM Add-in



Ci\,„\E*telAddln3.dll.manrft rt

COM Atfd-in


j UkM'tive A|ipHC-Mion Add-in»

An*Vm ToolPafc


Excel AddUIn

"Must £ enter

Analysis îoolfrafc - VfiA


Éïctl AddUn

ComtlhaoïWl Su» Wl»rd

fij-iif j.larri

Éxctl Add-in


Curto« XMl Dit)

DoewaïJit Inipeetor

[¡Mi iifflsft tag Ibtufc

DiUieflSmart TasWOfi.DU

Smart Tag

Euro Currency TcOli


Excel Ad4-In

Financial Symbol ilmart tag llsb|

D^_.«<I\Smart FagWOf l.Oll

Smart. Ta g

Head« 1 arid Footers


Oflçuenent inspcçtçr

Kidfltn Row? and Column;



DiUrtGffiWiÄOfff WHD.DLl

Doiuafrà Injpertor

frit c in e t Aj m vi* rtt VBA


lnvuiMe Cûrtttrtt

Document Inipertor

Lookup Vnïi-ard


Excel Add-iri

M«ro5oft: AiConj Pa««

XML i>"pani5iç>ni Pack

Ptrion Niove JOtflJOOk t-m»ll rtclpltntj]


Smart tig

Solw*i Adö-In


EsiMl Addhin

Telephone Number ¡Smart tag lim)

D^jwfVSmart TasfcMOf LDtl

Smart Tag

Tipne iL-mart lag lirti]

D^.«d\Srftart TagW.Ofl.DlL

Smart Tà g

rjocumenA KçUled Add litt


! ApfihfUor AdtMiH


C -■.eelAddinï.iîll.manrft Ft


Add-in: Active Application AdO-ins




Managt: fEsccel Adct-ins ^J Qp...

OK 1 Canal 1

Figure 14.6. Add-ins in the Exclusion list

Figure 14.6 shows two VSTO 2005 SE add-ins. ExcelAddin3 is listed under Active Application Add-ins, and ExcelAddin2 is listed under Disabled Application Add-ins. Each of these add-ins was created with VSTO 2005 SE, but only the problematic add-in has been disabled.

Because VSTO 2005 SE add-ins differ architecturally from and are more stable than VSTO add-ins, you might want to consider migrating existing VSTO add-ins for Outlook 2003 to VSTO 2005 SE add-ins.

Was this article helpful?

0 0

Post a comment