Extend SharePoint projects
Applies to: Visual Studio Visual 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:
Add a shortcut menu item. The menu item appears when you open the shortcut menu for a SharePoint project node in Solution Explorer by right-clicking the node or choosing it and then choosing the Shift+F10 keys. For more information, see How to: Add a shortcut menu item to SharePoint projects.
Add a custom property. The property appears in the Properties window when you choose a SharePoint project in Solution Explorer. For more information, see How to: Add a property to SharePoint projects.
For a walkthrough that demonstrates how to create, deploy, and test a project extension, see Walkthrough: Create a SharePoint project extension.
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
- 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
- Walkthrough: Create a SharePoint project extension
- Define custom SharePoint project item types
- Extend SharePoint project items
- Extend SharePoint packaging and deployment
- Extend the SharePoint project system