Introduced in Excel 2007
Consists of an assembly associated with a particular office application.
Typically the add-in runs when the associated application is started.
Functionality is available regardless of which document is open.
A VSTO add-in solves many of the problems associated with COM add-ins and is the preferred model for 2010, 2007 and 2003 add-in development.
Also referred to as Managed Office add-ins or Application Level add-ins.
A VSTO add-in is just a COM add-in that implements a simpler interface (IStartUp instead of IDTExtensibility2).
VSTO add-ins solve many of the problems associated with traditional COM add-ins and are the preferred method when creating add-ins for Office 2007 and later.
The only time you should consider using the IDExtensibility interface is if you need to target older versions of Office.
VSTO add-ins are displayed in the COM add-ins dialog box but cannot be added via the Add button. Instead they must be installed by double clicking on a .vsto file or setup.exe file.
Differences between VSTO add-ins and traditional COM add-ins
VSTO add-ins are built on the same COM Interface but there are some noticeable differences.
VSTO add-ins implement the IStartup Interface whereas COM add-ins implement the IDTExtensibility interface.
VSTO add-ins require explicit full trust permissions before they are allowed to be loaded, where as COM Add-ins just need to be registered.
VSTO add-ins have a manfest registry value which traditional COM add-ins do not have.
Advantages of VSTO add-ins
Implement a much simpler interface consisting of just two events: Startup and Shutdown.
Separate AppDomain for each add-in. All VSTO add-ins are loaded by the VSTOLoader.dll
Strongly Typed IStartUp interface, IDTExtensibility2 interface is not strongly typed
Provides application specific and version specific add-ins
Faster startup (streamlined load path)
Provides version resilience (version neutral so will work with future versions)
Creating a VSTO Add-in
The solution must be saved on your C drive.
If you try and create a solution on a network drive it will not have the necessary permissions to run.
These two lines are equivalent
Are these 2 lines equivalent
(File > New Project)
(Visual C# > Office > 2007)
Excel 2007 Add-in
This will create one project:
note that no setup project is created for you.
Building your Projects
When you build your project in Visual Studio the registry keys will be added to the registry automatically to make debugging easier.
These entries however are not removed from the registry when debugging terminates.
This can create confusion if you later install the add-in on the same PC or make changes to the project details.
If you are a developer using Visual Studio a solution cannot be installed and registered at the same time.
Office 2007 uses the Manifest registry key and has the ability to disable specific add-ins when there are problems
If you use ClickOnce to deploy your add-in the registry keys are created automatically for you.
Excluded from Primary Output
The .vsto and .manifest files are excluded from the primary output when you add it to a setup project
Fast Path Loading
This is a new way to load and launch VSTO add-ins that is much faster than the current method.
This has been added in Visual Studio 2010 SP1
If you are using Visual Studio 2010 SP1 then you must add the prefix file:/// to the registry manifest
This speed is achieved by bypassing the following steps:
1) Schema validation on the manifests
2) Any automatic update checking
3) Security checks - the digital signature of the manifests will not be validated
To take advantage of fast path loading your add-in must meet the following conditions:
must be installed under Program Files
must be registered as |vstolocal in the registry
must be deployed via an MSI windows installer
© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext