An assembly is a collection of classes and functionality that is stored as an executable file (.exe) or a library (.dll). When you compile a .NET language such as Visual Basic 2005, your code is not compiled directly into machine language, or binary code. Instead, it is compiled into an assembly-like language known as Intermediate Language (IL). No matter which language you use (Visual Basic 2005 or C#) to create a VSTO solution, the build process compiles the code into IL. The assembly contains both IL and metadata that describes each class and its members, along with information about the assembly itself, such as the assembly name, version, and any dependencies it has.

Assemblies can be private or shared. A private assembly normally contains code that is intended to be used by only one application. These assemblies can reside in the same folder as the application that uses them, or in a subfolder of the application. For example, when you create and build a VSTO solution, the compiled code is saved in a subfolder of your solution.

Shared assemblies, on the other hand, are designed to be shared among many applications. Because any software can access these assemblies, they should be stored in a special directory known as the global assembly cache (GAC). An example of a shared assembly is an Office primary interop assembly (PIA) described later in this chapter.

0 0

Post a comment