Solution Assemblies

As you learned earlier In this chapter, an assembly Is a collection of classes and functionality that is stored as an executable file (.exe) or a library (.dll). When you build a VSTO solution, the code is compiled and stored in a single assembly (DLL file) located in the \bin\debug (or \bin\release) directory of your solution. The assembly isn't stored inside the document, but the document does include an application manifest, which contains information about the name and location of the assembly. There are two manifests: an application manifest (which is stored in the document via an embedded control called the Runtime Storage Control) and a deployment manifest,, which is located in the same directory where the assembly is deployed.

Even though you can associate a VSTO solution assembly only with a particular document (you can have only one solution assembly associated with a document), your solution assembly can reference other assemblies. For example, to add a common group of user controls to the actions pane, you can save a library of user controls in an assembly and then reference that assembly from multiple VSTO solutions.

How do you determine which VSTO assembly is associated with a particular document? You look at the document properties. You can view the document properties of a Word document or Excel workbook by clicking Properties in the File menu. A VSTO-enabled document has two custom document properties that indicate that the document is a VSTO solution. The first custom property is named _AssemblyName. If the value of _AssemblyName is an asterisk (*), it means that the document has an associated VSTO customization (assembly). The second custom property, _AssemblyLocation, stores the globally unique identifier (GUID) of the Runtime Storage Control (which contains the application manifest and information about where to locate the associated assembly). Figure 3.10 shows the custom document properties of a Word solution.

SampleDocument .doc Propertie

General | Summary | Statistics | Contents Custom | Name;

Type: Value: Properties:

General | Summary | Statistics | Contents Custom | Name;

Cheeked by



Date completed







Value Type

:_A«emblyName _AssemblyLoc..,

+ Text {2e2fl25f-52Cl... Text

1 ►!

Figure 3.10. Custom document properties of a Word solution

0 0

Post a comment