Create Site Definition in SharePoint2010 Part1
- by ybbest
Creating Site definition in Visual Studio2010 is very easy; it has a built-in Site Definition Project template. Today I will show you how to create Site Definition using Visual Studio 2010.You can download the complete source code here.
Create Site Definition Project
Choose the Site URL and note that you can only choose Farm Solution the sandboxed solution is greyed out.
After the Visual Studio did his magic, you can see the Project structure as follows, it contains default.aspx which is the default page for that site definition, onet.xml contains the actions for creating site using this site template(This is like the elements.xml in the feature) and webtemp_Ybbest.CustomSiteDef.xml register this Site definition in the SharePoint(This is similar to the Feature.xml in feature)
Open webtemp_Ybbest.CustomSiteDef.xml and modify ID field as it has to be unique and you can optionally choose to modify other fields as well.
Deploy your solution and you can find your site template when you creating your site in either Central admin or Site Creation in Site Actions Menu
Create your site collection using your new site template and then navigate to the site you will find the site created by using your site definition.