Поделиться через


Assemblies in Office Solutions Overview

When you create an Office project by using the Office development tools in Visual Studio, the code that you write is eventually compiled into an assembly. The assembly is usually deployed to a shared server or to a directory on the client computer.

For more information about assemblies, see Assemblies in the Common Language Runtime.

Applies to: The information in this topic applies to document-level projects and application-level projects for Microsoft Office 2010 and the 2007 Microsoft Office system. For more information, see Features Available by Office Application and Project Type.

Assemblies in Office Solutions

Assemblies in Office solutions 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.

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 an Office solution to run on a computer, the assemblies used by the solution must be trusted to run. For more information about security, see Securing Office Solutions.

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.

See Also

Tasks

How to: Open Office Solutions without Running Code

How to: Target Office Applications Through Primary Interop Assemblies

Concepts

Application and Deployment Manifests in Office Solutions

Other Resources

Designing and Creating Office Solutions

Architecture of Office Solutions in Visual Studio