Site Definition and Web Template are used for building a SharePoint site. If you are new to SharePoint, you may wonder which one to use?. Well, it depends on your site requirements and extensibility. Both are used to build a site UI interface to the end user.  The major difference is a Web template is always based on a existing Site Definition either directly or indirectly. I have outlined some comparisons in the below table


Site Definition

Web Template

core definition in SharePoint Based on existing Site Definition either directly or indirectly
Stored on a Front-end Web Server in folder

%ProgramFiles%Common FilesMicrosoft Sharedweb server extensions14TEMPLATESiteTemplates

Stored as a .wsp file in SharePoint Database.
Complex to create Easier to create
Deployed as Farm solutions with Admin rights Deployed in Solution Gallery(Sandbox)
Once def, cannot be modified can be modified without affecting existing sites
Configurations are defined in WebTemp*.xml and ONET.xml
WebTemp*.xml file contains one or more Template elements which represents a Site Definition
Details of each Template element in WebTemp*.xml are stored in a corresponding Configuration element in the ONET.xml file.
Configurations are defined in a xml and ONET.xml(part of .wsp file).

In the XML, The only difference is WebTemplate element instead of Template as defined in WebTemp*.xml.

The ONET.xml is simpler than that of Site Definition ONET.xml.



1) Sites created from a Site Definition or Sites created from a Web Template (that is based on the Site Definition) may not work properly if modified or removed. New sites based on Site Definition cannot be created. 

2) Out of Site Definition and Web Template, Web Template is easier to create ,maintain, modify and deploy. A Site definition is preferred, when you need custom components(defined in ONET.xml) and email footers,.

3) If you go for a Site Definition, the best practice is to have a minimal Site Definition to be acted as model and extend it with using Site Features whenever required.

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.