SharePoint 2010: Creating a Site Definition Using Visual Studio 2010

A SharePoint site definition is the core definition of what a site in SharePoint. A site definition can include more than one site definition configurations i.e. family of configurations.  A configuration specifies the sets of lists, Features, Modules etc. that are included when a new site is created.

Each site definition is a combination of .aspx , .ascx, .master along with .xml file in Collaborative Application Markup Language(CAML) that are placed in %Program Files%Common FilesMicrosoft Sharedweb server extensions14TEMPLATESite Templates.

Every site definition structure and content is governed by a set of XML files in CAML format. Prominent among them are

WebTemp*.xml : Provide information about how they appear in the UI.

When SharePoint installed, a global WebTemp*.xml is installed in %Program Files%Common FilesMicrosoft Sharedweb server extensions14TEMPLATELCIDXML

where LCID is the numeric ID of language/culture. ex: 1033 for English.

For each site definition, there will be one WebTemp*.xml.

General format of WebTemp*.xml is as shown below

      <Template Name=”<name>” ID=”ID1”>

        <Configuration ID=”<someid>” Title=”title">


         <Configuration ID=”<someid>” Title=”title">



      <Template Name=”<name>” ID=”ID1”>



    … …


Each <Template> element represents a site definition. Every Site Definition is provided with one or more <Configuration> elements. If you want to know more about <Configuration> element, follow this link

Onet.xml : All about Navigation areas, List Definitions, Modules, Document Templates, List Templates, Configurations, BaseTypes, Components.

When SharePoint installed, a global Onet.xml is installed in %Program Files%Common FilesMicrosoft Sharedweb server extensions14TEMPLATEGLOBALXML.

For each site definition, there is a corresponding Onet.xml installed in subdirectory(template name) at  %Program Files%Common FilesMicrosoft Sharedweb server extensions14TEMPLATESiteTemplates



Click on this link to know more about format of Onet.xml file.

A Site definition deployed once cannot be modified. The best way is to create a new kind of site. This can be done by creating a new WebTemp*.xml and Onet.xml. 

Few points to remember

  • SharePoint 2010 must be installed on the dev machine. No longer Visual Studio 2010 supports remote debugging for SharePoint.
  • Instance of Visual Studio 2010 must run with elevated permissions i.e. Run as Administrator.


  • Solution must be deployed as  Farm solutions rather than as Sandbox solutions.

Please follow this link if you want to what is a Sandbox solution in SharePoint 2010.

Follow this link to know differences between Farm solutions and Sandbox solutions.


Creating a Site Template

To create a site template follow these steps

1) Open Visual Studio 2010 (as administrator), Click on File->New->Project. Select the Site Definition project template under SharePoint 2010 templates folder. Provide solution name and location, Click Ok button.


2) Next you’ll see a SharePoint Customization Wizard asking for local site for debugging and deployment. Provide your SharePoint Url and select Deploy as a Farm Solution radio option and then Click Finish.


3) A new solution will be created as shown in the below image. Note that two xml(WebTemp*.xml, ONet.xml) files are created. And also Features and Modules


4) Click Build->Deploy, solution will be deployed on the SharePoint. All Done.

5) Open SharePoint Central Administration Web page, create a new site from your custom site definition.


6) Open newly created site, you’ll see a custom site web page derived from your site definition.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.