Delen via


Extending SharePoint Projects

Create a project extension when you want to customize project-level features of SharePoint projects. For example, you can add custom project properties, or respond to project-level events that are raised when the user develops a SharePoint solution in Visual Studio.

Creating Project Extensions

To extend a project item, build a Visual Studio extension assembly that implements the ISharePointProjectExtension interface. For more information, see How to: Create a SharePoint Project Extension.

When you create a project extension, you can also add the following functionality to the SharePoint projects:

For a walkthrough that demonstrates how to create, deploy, and test a project extension, see Walkthrough: Creating a SharePoint Project Extension.

Understanding the Relationship Between Project Extensions and Project Instances

When you create a project extension, the extension loads when any kind of SharePoint project is opened in Visual Studio. Visual Studio includes several SharePoint project templates, such as list definitions, content types, and event receivers. However, there is only one SharePoint project type. The project types that appear in the New Project dialog box are only templates that bundle together one or more SharePoint project items. Because there is only one SharePoint project type, extensions created for one project apply to all SharePoint projects. You cannot, for example, create an extension that applies to only a Content Type project.

To access a specific project instance, handle one of the ISharePointProjectEvents events of the projectService parameter in your implementation of the ISharePointProjectExtension.Initialize method. For example, to determine when a SharePoint project is added to a solution, handle the ProjectAdded event. For more information, see How to: Create a SharePoint Project Extension.

See Also

Tasks

Walkthrough: Creating a SharePoint Project Extension

Concepts

How to: Create a SharePoint Project Extension

How to: Add a Shortcut Menu Item to SharePoint Projects

How to: Add a Property to SharePoint Projects

Defining Custom SharePoint Project Item Types

Extending SharePoint Project Items

Extending SharePoint Packaging and Deployment

Extending the SharePoint Project System