Partager via


Developing SharePoint Solutions

Several SharePoint project type templates are available in Visual Studio for creating SharePoint sites and site elements. For a list of the available project types, see SharePoint Project and Project Item Templates. Following is a description of the elements and properties of a SharePoint project.

For information about SharePoint 2013 and apps for SharePoint, see SharePoint 2013 and Build apps for SharePoint.

Elements of a SharePoint Project

The nodes under a SharePoint project are known as SharePoint items. SharePoint items may also contain one or more subfiles, referred to as SharePoint item files, such as XML configuration files, .aspx forms, and more.

Instead of creating projects by using project templates that are already populated with project item files, you can use the Empty Project template to create an empty SharePoint project and then add project items manually. SharePoint projects can also optionally contain one or more feature files (for activation in SharePoint) and a package file in which to distribute the project.

Special Nodes

Every SharePoint project contains two nodes that cannot be renamed, deleted, cut, copied, or dragged from the project. These nodes are as follows:

  • Features

  • Package

Both nodes always appear in all SharePoint projects even if no features or packages are defined for the project.

Features Node

The Features node contains one or more SharePoint project features. A feature is a container of extensions for SharePoint. After a feature is deployed to SharePoint server, it can be included in site definitions or activated individually by SharePoint administrators on SharePoint sites. For more information, see Working with Features.

When you add an item, such as a content type or a list instance, to a SharePoint project, it is added to a feature in the Features node. The scope of the item determines whether it is added to a new or existing feature. If the new item has the same scope as an existing feature, then it is added to that feature. Otherwise, the item is added to a new feature.

To manually add a feature, execute the Add Feature command on the feature node's shortcut menu. You can view or change the contents of a feature by using the Feature Designer. For more information, see How to: Customize a SharePoint Feature.

When a feature is added to a SharePoint project, it appears in Solution Explorer as a node with the default name Featurex.feature, where x is a unique number. After a feature is deployed to the SharePoint Server, a SharePoint administrator can activate it, making it available to SharePoint site users.

Package Node

The Package node contains a single file that serves as the distribution mechanism for the SharePoint project. This file, known as a solutionpackage, is .CAB-based with a .WSP extension. A solution package is a deployable, reusable file that contains a set of features, site definitions, and assemblies that apply to SharePoint sites, and that you can enable or disable individually. The Package node also always contains a file that is named Package.wspdef, an XML definition file for the package. Once a package is deployed to the server that's running SharePoint, the SharePoint administrator can install it and activate its features.

You can view or change the package’s contents in the Package Designer either by double-clicking the package node or by opening its shortcut menu and then choosing Open. For more information, see Creating SharePoint Solution Packages.

SharePoint Project and Project Item Properties

SharePoint projects, just like other Visual Studio projects, display properties in the Properties window and the Properties Page. The properties that are displayed depend on the node that is selected.

When a SharePoint project, project item, or project item file node is selected in Solution Explorer, the following properties appear in the Properties window or the Properties Page:

Project Properties

Property Name

Description

Active Deployment Configuration

Specifies the series of steps performed during deployment. For more information, see How to: Edit a SharePoint Deployment Configuration.

Assembly Deployment Target

Determines where SharePoint application assemblies are located. Valid assembly location values are either GlobalAssemblyCache (default), or WebApplication.

If the Sandboxed Solution property is set to true, then this property is disabled.

Auto-retract after debugging

Specifies whether the deployed solution automatically retracts from SharePoint after running the application in debug mode in Visual Studio. When selected, the solution retracts when the IDE goes back to design view after debugging. When cleared, the solution does not retract. For more information, see Retracting a Solution.

Edit Configurations

Specifies the deployment configuration to use for the project. For more information, see How to: Edit a SharePoint Deployment Configuration and Deploying, Publishing, and Upgrading SharePoint Solution Packages.

Enable Silverlight Debugging (instead of Script debugging)

When selected, the Silverlight debugger attaches to the debugging process. When cleared, the Script debugger attaches to the debugging process. For more information, see Silverlight Debugging Overview.

Include Assembly in Package

Specifies whether the project assembly is packaged at build time or not.

Post-deployment Command Line

Specifies the commands to run after deploying the SharePoint solution. This line supports any batch commands as well as the resolution of MSBuild variables. For more information, see How to: Set SharePoint Deployment Commands.

Pre-deployment Command Line

Specifies the commands to run before deploying the SharePoint solution. This line supports any batch commands as well as the resolution of MSBuild variables. For more information, see How to: Set SharePoint Deployment Commands.

Project File

The name of the file containing build, configuration, and other information about the project.

Project Folder

The location of the project file on the system. (Read-only.)

Sandboxed Solution

Specifies whether the project should be deployed as a sandboxed solution, also known as a user-created solution. Sandboxed solutions are not necessarily trustworthy. A value of true means that the project is deployed as a sandboxed solution, a value of false means that the project is deployed as a farm solution. For more information, see Sandboxed Solution Considerations and Differences Between Sandboxed and Farm Solutions.

Site URL

Specifies the URL of the target site for this project.

Startup Item

Specifies the first item in the project to run.

When you choose a SharePoint item file (such as a workflow or a feature in the Features node), the following properties appear in the Properties window:

Project Item Properties

Property Name

Description

Deployment Conflict Resolution

Specifies the action to take when deploying a project item whose properties are identical to those of an item already on the server. For more information, see Troubleshooting SharePoint Packaging and Deployment.

Feature Properties

Specifies a set of values (stored as key/value pairs) that is included with a feature when it deploys to SharePoint. After the feature is deployed, you can access the property values in your code. For more information, see Providing Packaging and Deployment Information in Project Items.

Feature Receiver

Provides code that executes when certain events occur to a project item's containing feature. For more information, see Providing Packaging and Deployment Information in Project Items.

Folder Name

The name of the SharePoint project item folder.

Project Output References

Specifies a dependency, such as an assembly, that your project item needs to run. For more information, see Providing Packaging and Deployment Information in Project Items.

Safe Control Entries

Specifies controls that are safe for untrusted users to edit. For more information, see Providing Packaging and Deployment Information in Project Items.

Project Item File Properties

Property Name

Description

Build Action

Specifies how the file relates to the build and deployment processes. For more information, see File Properties.

Copy to Output Directory

Specifies whether the source file(s) will be copied to the Output directory. Can be one of the following values:

  • Do not copy

  • Copy always

  • Copy if newer

For more information, see File Properties.

Custom Tool

Specifies the name of a tool, if any, that transforms the file at design time and puts the output of the transformation into another file. For example, a dataset (.XSD) file has a default custom tool. For more information, see File Properties.

Custom Tool Namespace

The namespace into which the output of the custom tool is copied. For more information, see File Properties.

Deployment Location

The fully-qualified path of the file on the SharePoint server. This path is composed of the Deployment Root and Deployment Path sub-properties.

Deployment Path

The relative path of the file on the SharePoint Server file, such as Workflow1\. The fully-qualified path for the file is created by concatenating the Deployment Path value to the end of the Deployment Root value.

Selecting a value of RootFile for the Deployment Type property changes the Deployment Root property to {SharePointRoot}\, resulting in a fully-qualified path of {SharePointRoot}\Workflow1\. For more information, see Packaging and Deploying SharePoint Solutions.

Deployment Root

String. The root folder where the file is deployed on the SharePoint Server. For example, {SharePointRoot}\Template\Features\{FeatureName}\.

The value of the Deployment Root property is determined by the Deployment Type setting.

Deployment Type

The file's deployment type, which determines its Deployment Root value. Can be one of the following values:

Enum Value

Deployment Root Value

NoDeployment

<no value>

ElementManifest

{SharePointRoot}\Template\Features\{FeatureName}\

ElementFile

{SharePointRoot}\Template\Features\{FeatureName}\

TemplateFile

{SharePointRoot}\Template\

RootFile

{SharePointRoot}\

GlobalResource

{SharePointRoot}\Resources\

ClassResource

{ClassResourcePath}\

For more information, see DeploymentType.

File Name

The name of the file or folder for the item file.

Full Path

The location of the file for the item. (Read-only.)

Title

Description

SharePoint Project and Project Item Templates

Describes the SharePoint project and project item templates available to you in Visual Studio.

How to: Add Items to a SharePoint Project

Describes how to add new or existing items to a Visual Studio SharePoint project.

Walkthrough: Create a Site Column, Content Type, and List for SharePoint

Leads you step-by-step in creating a customer field, content type, list definition, and list instance.

How to: Create an Event Receiver

Describes how to add an event receiver for the project created in Walkthrough: Create a Site Column, Content Type, and List for SharePoint.

Creating SharePoint Workflow Solutions

Describes how to create workflow projects that includes workflow association forms and workflow initiation forms.

Creating Pages for SharePoint

Describes how you can create pages such as application pages, site pages, master pages, and page layouts for SharePoint.

Creating Web Parts for SharePoint

Describes how to add controls that enable users to directly modify the content, appearance, and behavior of SharePoint site pages by using a browser.

Creating Reusable Controls for Web Parts or Application Pages

Describes how to create user controls that can be consumed by application pages and Web Parts that run in SharePoint.

Integrating Business Data into SharePoint

Describes how to integrate data from Web services and back-end server applications into a SharePoint application.

Creating Site Definitions for SharePoint

Describes how to create site definitions: templates that are used to create SharePoint sites.

Importing Items from an Existing SharePoint Site

Describes how to import items such as content types and modules from an existing SharePoint site into a Visual Studio SharePoint project.

Using Modules to Include Files in the Solution

Describes how to use modules to deploy files from your Visual Studio project to the SharePoint site.

Browsing SharePoint Connections Using Server Explorer

Describes how to browse local SharePoint sites by using Server Explorer.

Providing Packaging and Deployment Information in Project Items

Describes how to use project item properties to provide packaging and deployment information for projects, such as safe control entries, project output references, and feature properties.

How to: Add and Remove Mapped Folders

Describes how mapped folders can be added to your project to provide easier access to SharePoint resources.

Sandboxed Solution Considerations

Describes the issues associated with sandboxed solutions.

Security for SharePoint Solutions

Describes security considerations for developing SharePoint solutions in Visual Studio.

URL Picker Dialog Box (SharePoint development in Visual Studio)

Describes a dialog box that you can use to add path references to resources in your project or on the local SharePoint server.

See Also

Other Resources

Getting Started (SharePoint Development in Visual Studio)

Browsing SharePoint Connections Using Server Explorer

Building and Debugging SharePoint Solutions

Packaging and Deploying SharePoint Solutions