Udostępnij za pośrednictwem


Assemblies in Office Solutions Overview

The code that you write in Visual Studio Tools for Office projects is eventually compiled into an assembly. Assemblies in Visual Studio Tools for Office solutions are usually deployed to a shared server or to a directory on the client computer.

For more information about assemblies, see Assemblies Overview.

Assemblies in Office Solutions

Assemblies in Visual Studio Tools for Office projects are loaded by a Microsoft Office application. After the assembly is loaded, code in the assembly can respond to events that are raised in the application (for example, when a user clicks a menu item). Code in the assembly can also call into the object model to automate and extend the application, and it can use any of the classes in the .NET Framework. For more information, see Architecture of Document-Level Customizations and Architecture of Application-Level Add-Ins.

Visual Studio Tools for Office solutions use deployment manifests and application manifests to identify the assembly. The manifests contain information about the assembly's name, version, and location, so that the application can find, link to, and run the correct assembly. For more information, see Application and Deployment Manifests in Office Solutions.

Document-level projects include a document in addition to an assembly. The document acts as the front end of the application and is where all user interaction takes place. Each document can have only one main project assembly associated with it; however, multiple documents can point to the same assembly.

Assemblies in document-level projects are not embedded in the document; instead, they are stored elsewhere and are identified by the document's application manifest.

Security Considerations for Assemblies

For a Visual Studio Tools for Office solution to run on a computer, the assemblies used by the solution must be trusted to run. Assemblies for 2007 Microsoft Office and Microsoft Office 2003 solutions have different trust requirements. For more information about security, see Security in Office Solutions (2007 System) and Security in Office Solutions (2003 System).

By default, the solution assembly and any referenced assemblies that are in your project's output folder are trusted to run on the development computer when you build the project. For more information, see Office Solution Build Process Overview.

For security reasons, it is best to create projects on your local computer, rather than developing on a shared location. For more information, see Collaborative Development of Office Solutions.

Referenced Assemblies

The assembly can reference other assemblies, which are listed in the project's references. However, one document-level project assembly cannot reference another document-level project assembly.

Offline Support for Referenced Assemblies in Microsoft Office 2003 Solutions

If your Microsoft Office 2003 solution depends on the Internet Explorer cache to provide offline capability, you must explicitly load all referenced assemblies or they might not be available to the application while offline. Assemblies are not loaded into the Internet Explorer cache until they are used. If the solution did not call a referenced assembly while online, that referenced assembly is not available offline. To ensure that all assemblies are loaded into the cache when the solution is opened online, call Load on each referenced assembly in the solution in the Startup event handler.

For more information about offline support for Microsoft Office 2003 solutions, see Offline Model for Office Solutions (2003 System).

See Also

Tasks

How to: Open Office Solutions without Running Code

How to: Target Office Applications Through Primary Interop Assemblies

Concepts

Creating Office Solutions in Visual Studio

Application and Deployment Manifests in Office Solutions

Other Resources

Architecture of Visual Studio Tools for Office Solutions