Share via


Extend SharePoint projects

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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.

Create 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:

Understand 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 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