This documentation is archived and is not being maintained.

Overview of Integrating Visual Studio Tools for Applications

Visual Studio 2008

To integrate Visual Studio Tools for Applications with a host application, you perform the following steps:

  1. Create a proxy assembly for your application's object model.

  2. Register your host application.

  3. Create project templates that add-in developers use to create add-ins for your application.

  4. Modify your host application so that it discovers and loads add-ins.

  5. Incorporate the redistributable integrated development environment (IDE) with your host application.

  6. (Optional) Create in-process hosts, which you can use to extend the project system by automating the IDE.

  7. (Optional) Create, remove, and modify host items and host objects in add-in projects in response to events in the host application.

  8. Implement a deployment process for add-ins. This can be by enabling users to simply copy add-ins to an add-in folder, or by implementing a ClickOnce deployment model for add-ins for your application.

  9. Modify the Setup program of the host application to install Visual Studio Tools for Applications and other files and settings on the end-user computer.

The Visual Studio Tools for Applications SDK includes samples that demonstrate the process of integrating Visual Studio Tools for Applications with a managed application and an unmanaged application. For more information, see ShapeApp Samples (Visual Studio Tools for Applications).

The first step to integrating Visual Studio Tools for Applications into your application is to create proxies for your application's object model. A proxy is a type that represents the add-in's view of a type in the host application object model. Add-ins use instances of the proxy types, instead of instantiating types in the object model of your host application directly.

To create proxies for your object model, you use the Proxy Generation tool (ProxyGen.exe). This tool converts the type definitions in a COM type library or a managed assembly into a C# proxy code file that you compile into a proxy assembly. You use the proxy assembly, along with all of the files that are necessary to create an add-in for your application, to create a project template.

For more information about creating proxies, see Creating Proxies.

You must register your application with the Visual Studio Tools for Applications IDE before you can create project templates. Registering the application enables you to associate the project template with your host application by specifying the host identifier (HostID) for the host application in the project template. You can add values to the registry to customize the IDE, such as setting the name to appear in the title bar of the IDE and specifying the location of project templates.

For more information about registering the host application, see Registering the Host Application.

You create project templates to enable add-in developers to create add-ins for your application. Project templates provide the basic files that are needed for a project type, include references to assemblies, and set default project properties and compiler options.

You can create the project template by using the Project Template Generation tool (ProjectGen.exe). This tool generates all of the files that make up a Visual Studio project template.

For more information about creating project templates, see Creating Project Templates (Visual Studio Tools for Applications).

You must write code that discovers and loads add-ins. You can add this code directly to the host application, or you can implement the code in a separate component that is linked to the application.

To discover and load add-ins, you use the .NET Framework add-in programming model. This is a set of classes that provide the following options:

  • You can load add-ins into new or existing application domains.

  • You can load add-ins into the application's process or an external process.

  • You can specify the permission set or trust level of the application domain or process in which the add-in is loaded.

When you load an add-in, you must also provide several services that enable the host application and add-ins to access each other's types.

For more information, see Discovering and Loading Add-Ins.

You can include the redistributable Visual Studio Tools for Applications IDE with the host application. Your end users can use this IDE to write add-ins. You can customize the IDE, start and stop the IDE from your application, and automatically configure a debugging session from your application.

In addition, end users can use your project templates in a full version of Visual Studio 2008 to create add-ins.

For more information, see Incorporating the Integrated Development Environment.

You can create an in-process host to customize the project behavior of the IDE of either Visual Studio or Visual Studio Tools for Applications. For example, you can create an in-process host to display a designer when the user double-clicks a project in Project Explorer. After you create an in-process host, you add it to your application's project template.

For more information about in-process hosts, see Creating In-Process Hosts.

You can add the ability to create, remove, and modify host items and host objects dynamically; that is, in an add-in project in response to events in the host application. Host items and host objects are classes that are used in an add-in project that extend objects in the host application.

By dynamically creating or modifying host items and host objects, you can provide a dynamic programming model that automatically updates code in the project in response to events in the application. For example, if your application supports developing an add-in that customizes documents, you can generate a new document host item class in the project when the add-in developer creates a new document in the application at design time.

For more information, see Dynamically Creating and Modifying Host Items and Host Objects in an Add-in Project.

Several types of add-in deployment are supported by Visual Studio Tools for Applications. The most basic is to enable users to copy add-ins to a specific folder, where the add-ins are discovered and loaded. Optionally, you can implement a ClickOnce deployment model for add-ins for your application. If you do this, add-in developers can use ClickOnce to add greater security to the add-ins they create for the host application. For more information, see Securing and Deploying Add-Ins.

You must modify the Setup program of the host application to install Visual Studio Tools for Applications, the project templates, and the proxy assembly. The Setup program must also create required registry keys on the end-user computer.

For more information, see Deploying the IDE and Runtime.

Show: