Creating 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 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.

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.

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

File NameDescription
default.aspxThe default ASPX home page for the new SharePoint site.
onet.xmlSpecifies 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.xmlSpecifies 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.

TitleDescription
Walkthrough: Create a Basic Site Definition ProjectLeads you step-by-step through the creation of a basic site definition project in Visual Studio.
How to: Create a Custom Site Definition and ConfigurationDescribes how to create a custom site definition in SharePoint by copying an existing site definition and then modifying the copy.
WebTemp.xmlDescribes the original file that specifies the site definitions available in the Template Selection section of the New SharePoint Site page.
Localizing SharePoint SolutionsDescribes how to prepare your SharePoint solutions for global use.
Creating Web Parts for SharePointDescribes how you can create parts of a SharePoint page that users can modify.
Creating Reusable Controls for Web Parts or Application PagesDescribes how you can create reusable controls that run in application pages and Web Parts.
Visual Web DeveloperDescribes how to use the designer that appears when you open a Web page in your project.
ASP.NET Web Pages OverviewProvides 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 SyntaxDescribes the markup elements that make up an ASP.NET page.
Programming ASP.NET Web PagesProvides information about how to create event handlers in ASP.NET pages and how to work with client script.
Programming in Windows SharePoint ServicesDescribes how to use the managed object model that is provided in Windows SharePoint Services.

Developing SharePoint Solutions

Show: