nThis is just to quickly share some views on how to create a custom site definition using Visual Studio 2011 Beta.
n
nThis is a great enhancement for someone like me who really remembered all XML tags which are in Onet.xml / Site Definition. Now you dont have to do this manually at all , just create a solution and add new site definition in it using UI. How ? here is the answer.
n
nI have created a sample solution using VS 2011 beta and adding new SharePoint site definition to it.
n
n
n
nThis is a great enhancement for someone like me who really remembered all XML tags which are in Onet.xml / Site Definition. Now you dont have to do this manually at all , just create a solution and add new site definition in it using UI. How ? here is the answer.
n
nI have created a sample solution using VS 2011 beta and adding new SharePoint site definition to it.
n
n
n
n
n
n
n
nI have just added a new site definition to the project and given name as TestSiteDefinition.
n
n
n
nOnce you are done with these clicks , take a look at the solution explorer and see which are the files which are added. VS adds all files related to site definition like Onet.xml , webtemp_*.xml and a default page automatically , which we used to write and add manually for MOSS 2007 and SharePoint 2010 using previous versions of VS.
n
n
n
n
n
n
n
n
n
n
n
n
nLets take a look at each file –
n
n
n
n1. default.aspx – This is a standard SharePoint page with default.master as master page and has only twocontent controls on it which refers to the PlaceHolders from maste page – one is PlaceHolderPageTitle and other is PlaceHolderMain. You can now edit the file and add your customizations on it.
n
n
n
n2. Onet.xml – This file contains all elements like Project, NavBars,Configuration and Modules. By default no feature is added in the SiteFeatures and WebFeatures elements of default configuration ID 0 , and a module is added whcih points to the default.aspx page. but wondering why ListTemplates and DocumentTemplate elements are missing here.
n
nYou can read more on onet.xml here
n
n
n
n3. webtemp_TestSiteDefinition.xml – This file contains Template element. custom template is given ID of 10000 by default and display category is SharePoint Customizations by default.
n
n
n
nNow I will just right click the solution and deploy this custom site definition and see what happens – and here is the output
n
n
n
n
n
n
n
n
n
n
nConclusion : Now with the new version of VS it is much easy to create site definitions and get started with your customizations.
n
n
n
n
n
n
n