This article describes how to create a custom site definition in SharePoint 2010. The process to create a custom site definition has not changed much since the last version of SharePoint, the only differences are the directory names and some of the XML in the WEBTEMP files. See this blog post if you would like to see how this is done in WSS 3.0 / MOSS 2007.
Site Definition basics
Site definitions are located in the following folder on the SharePoint server:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions14TEMPLATESiteTemplates
Each site definition has its own sub directory under this folder.
Inside each site definition sub directory the .aspx pages for the various web pages and lists that make up the site definition are stored. Some of the new site definitions that come with SharePoint 2010 also include image files in these subdirectories. The ONET.XML file specifies the various configurations and modules the site definition is made up of. It is stored inside the XML subdirectory inside each site definition sub directory.
*Note: I think it is interesting that the SDK refers to Site Templates as the .stp files that are generated when you save a site as a template from the web UI, and the SDK refers to file based site templates as site definitions – yet this directory is named SiteTemplates. This has been the case for a couple of versions now so I don’t think we’ll see it change in the future.
Site definitions are registered with SharePoint and made available via the WEBTEMP<NAME OF SITE DEFINITION>.XML file. Theoretically, you could register a site definition with SharePoint with one of the out of the box WEBTEMP XML files, however this could introduce problems when service packs or newer versions of the product are released. It is considered best practice to create your own WEBTEMP XML file to register your custom site definitions.
WEBTEMP XML files are located in the following folder on the SharePoint server:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions14TEMPLATE1033XML
Creating a custom Site Definition in SharePoint 2010 – Manual Approach
Step 1: Clone an existing Site Definition
Step 2: Create the WEBTEMP XML fragment file to register the site definition with SharePoint
Step 3: Reset the application pool
Step 4: Create a site based on the custom site definition
Step 1: Clone an existing site definition
Navigate to the following directory on the SharePoint server in Windows Explorer:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions14TEMPLATESiteTemplates
Rename the Copy of STS directory to SAMPLE
Step 2: Create the WEBTEMP XML fragment file to register the site definition with SharePoint
Create a file called WEBTEMPSAMPLE.XML in the following directory:
C:Program FilesCommon FilesMicrosoft Sharedweb server extensions14TEMPLATE1033XML
<?xml version="1.0" encoding="utf-8"?><!-- _lcid="1033" _version="14.0.4514" _dal="1" --><!-- _LocalBinding --><Templates xmlns:ows="Microsoft SharePoint"> <Template Name="SAMPLE" ID="10001"> <Configuration ID="0" Title="Sample Team Site" Hidden="FALSE" ImageUrl="/_layouts/images/stts.png" Description="A sample team site." DisplayCategory="Custom Site Definitions" > </Configuration> <Configuration ID="1" Title="Sample Blank Site" Hidden="FALSE" ImageUrl="/_layouts/images/stbs.png" Description="A sample blank site." DisplayCategory="Custom Site Definitions" AllowGlobalFeatureAssociations="False" > </Configuration> <Configuration ID="2" Title="Sample Document Workspace" Hidden="FALSE" ImageUrl="/_layouts/images/stdw.png" Description="A sample document workspace." DisplayCategory="Custom Site Definitions" > </Configuration> </Template> </Templates>
Save the file.
Step 3: Reset IIS
Open a command prompt on the SharePoint server
Type in the command: iisreset
Wait for IIS to reset
Step 4: Create a site based on the custom site definition
Open Internet Explorer
Navigate to a SharePoint site on the server where you performed the steps above.
Click the Site Actions menu
Select New Site
Click the Custom Site Definitions tab on the left side of the create a site dialog to see the new site templates you registered with the SAMPLE site definition.
Select one of the sample site templates you created.
Enter a title and URL
Click the Create button and your new SharePoint site is created.
Creating a custom Site Definition in SharePoint 2010 – Visual Studio 2010 Approach
Visual Studio 2010 simplifies the process by providing a project type specifically tailored for this purpose. To create a custom site definition with Visual Studio 2010 first create a new Site Definition project. See the screenshot below for reference.
Then set the path to the SharePoint site where you would like to deploy the site definition.
Once the project is created, you can see all the files needed to support a custom site definition in the Solution Explorer.
After you make edits to the files all you need to do is press F5 and the custom site definition is packaged into a WSP and deployed to the SharePoint server. All that is left to do is to create a new site based on the custom site definition to verify it works properly.
Here you can see what the site template looks like when you use the out of the box Visual Studio 2010 Site Definition project type.
Wrap Up
There are several blog posts which discuss when and why you may want to create a custom site definition. Some folks are of the opinion it is something you should never do, other folks believe it makes sense to do it in certain situations. Personally, I believe they are a good solution when you need a new ID to staple features to.

Did any of the ONET/WEBTEMP schemas change between 2007 and 2010? Are there any new attributes we can use? I saw something that disabled feature stapling, has that always been there?
Hi Brian,
The AllowGlobalFeatureAssociations attribute has been available since WSS 3.0.
You can find out about all changes in the SDK and the articles listed on this page:
msdn.microsoft.com/en-us/sharepoint/ee514561.aspx
Hi Warren,
To view source on a SharePoint dialog page right click it and select properties. Then copy the URL and paste it into your web browser. Then you can view the source for the dialog page.
The ImageURL property in the configuration corresponding to your custom site template should point to the location where you deployed your preview image. The path you are using is different from the default path, that’s probably the issue.
Hi Todd,
I managed to get my image to appear now, by changing the image to a .png format. It seemed happy in a subdirectory so that is good.
cheers
Warren
SharePoint 2010 Resources
for a long time I was looking for something useful
mlb jerseys wholesale
new era hats
classic dress watches
and interesting and finally I found owing to you!
this blog is very interesting and I got more fun and knowledge I’ve actually been wondering about travel guides and I have also provide some traveling guide as Budget Hotels Melbourne – One stop online shop to find Cheap Flights Melbourne, Best Hotel Deals Melbourne, Cheap Hotels, Cheap Airfares Melbourne at the most competitive price in the easiest way. For more visit this url http://www.gocrazy4travel.com.au
Good that you wrote it down, I just needed this info again, and also forgot about it.
Good 0neCan we add site columns to these site templt.If yes how pls help.
panerai panerai
patek philippe patek philippe
replica patek philippe watches replica patek philippe watches
replica breitling watches replica breitling watches
longines watches longines watches
audemars piguet audemars piguet
rolex watches rolex watches
cartier watches cartier watches
panerai watches panerai watches
breitling watches breitling watches
replica panerai watches replica panerai watches
omega watches omega watches
ladies watches ladies watches
audemars piguet watches audemars piguet watches
womens watches womens watches
tag heuer tag heuer
replica rolex watches replica rolex watches
omega omega
replica watches replica watches
patek philippe watches patek philippe watches
rolex rolex
longines longines
replica longines watches replica longines watches
replica tag heuer watches replica tag heuer watches
replica cartier watches replica cartier watches
replica watches replica watches
tag heuer watches tag heuer watches
mens watches mens watches
breitling breitling
cartier cartier
I followed the same steps to create a custom blog site, but I get a weird behaviour with the ribbon, as soon as I create a new site from the cloned site, and click on the default list view, it goes to edit mode automatically? Something is going weird on the ribbon that I cannot figure out?
I have created one Team Site (Test) with one Content Type in sharepoint 2010. I used Solution Generator for creating Site Definition in SharePoint 2007.But currently I am working in SharePoint 2010 and sharepoint 2010 SDK does not incude solution generator which was in wss 3.0. Please provide any documents if u have for creating Site Definition in SharePoint 2010.
Thanks in Advance……
Hi, Do we have to be on the Server to create sitedefinition using SharePoint Template of Visual Studio 2010. I have a client computer (Developer Laptop) and we have dev server.I have adm access on site collection. Is there any way to create a Site Def without going onto the server. I used to do that in 2007