Create site definitions for SharePoint

The SharePoint Site Definition project in Visual Studio lets you create a site definition, which serves as a foundation for a new SharePoint site. These definitions not only determine the appearance and behavior of the SharePoint site, but also its default content and functionality. In the definition you can put preconfigured lists, content types, event receivers, images, and other items. SharePoint includes some site definitions such as BLOG, for example. When you create a site based on the BLOG site definition, the site contains the lists, Web parts, and other items that a blogging site requires.

For more information about site definitions, see Site Templates and Definitions.

Site definition projects

Site definition projects in Visual Studio provide only the basic files that a SharePoint site needs; they do not provide any default functionality. You must add files and content to provide the functionality that you want. You can build the site manually, by creating and adding the files that you need.

Feature stapling

One benefit of creating site definitions in Visual Studio is that they automatically use Feature Stapling. Feature Stapling attaches a feature to a site definition instead of embedding its functionality in the site definition itself. Doing this lets you add the feature to any site created by using the site definition without modifying the original site definition. For more information, see Feature Stapling.

Site definition project components

When you create a site definition solution, the following default files are added to its SiteDefinition node.

File Name Description
default.aspx The default ASPX home page for the new SharePoint site.
onet.xml Specifies the configuration of the new site, the components of the site definition template, and default behavior. These settings can include attributes such as the content types that are enabled, the default list views, document template files, and Web parts included with the site. By default, the Modules section lists the files to be added to the SharePoint site and how they are configured.
webtemp_<SiteDefinitionName>.xml Specifies the site definition configurations that appears in the Template Selection section of the New SharePoint Site page.

By default, all site definitions are stored in the <drive:>\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\SiteTemplates folder. Each site definition has its own subfolder.

Title Description
Walkthrough: Create a Basic Site Definition Project Leads you step-by-step through the creation of a basic site definition project in Visual Studio.
How to: Create a Custom Site Definition and Configuration Describes how to create a custom site definition in SharePoint by copying an existing site definition and then modifying the copy.
WebTemp.xml Describes the original file that specifies the site definitions available in the Template Selection section of the New SharePoint Site page.
Localize SharePoint solutions Describes how to prepare your SharePoint solutions for global use.
Create web parts for SharePoint Describes how you can create parts of a SharePoint page that users can modify.
Create reusable controls for web parts or application pages Describes how you can create reusable controls that run in application pages and Web Parts.
Visual Web Developer Describes how to use the designer that appears when you open a Web page in your project.
ASP.NET Web Pages Overview Provides general information about the structure of ASP.NET Web pages, how pages are processed by ASP.NET, and how ASP.NET pages display markup that complies with XHTML standards.
ASP.NET Web Page Syntax Describes the markup elements that make up an ASP.NET page.
Programming ASP.NET Web Pages Provides information about how to create event handlers in ASP.NET pages and how to work with client script.
Programming in Windows SharePoint Services Describes how to use the managed object model that is provided in Windows SharePoint Services.

See also