Search This Blog

Monday, March 7, 2011

12 Hive folder structure in sharepoint 2007

12 Hive folder structure in sharepoint 2007

Few things about 12 hive folder structure and how well it is mapped with the wsp schema.
SharePoint 2007 have a 12 hive structure which basically contains various files and folders that make SharePoint Interface. The files under 12 hive are mostly Uncustomized, that means they stay on the file system rather than in SharePoint database and perform better while rendering the Pages.
You would normally, deploy your Custom files like Custom Pages\layouts, webparts, css or javascript files under 12 hive, so that they can well interact with SharePoint site.

12 hive in SharePoint 2007 has various folders that make up a virtual path for the resources they contain. For e.g to access a CSS file deployed under styles folder we can use a path like

/_layouts/1033/styles/Customcss.css.

The most commonly used folders are :

\ISAPI\HELP\[LCID] - SharePoint help files. Deploy your own .chm files to this folder (or a localized subfolder)

\CONFIG - Web.config customizations

\ISAPI - SharePoint web services (deploy your custom web services here); this maps to /_vti_bin.

\Resources Global .resx - Files accessed from custom features and site definitions

\TEMPLATE\CONTROLTEMPLATES - deploy .ascx user controls here; maps to /_controltemplates

\TEMPLATE\FEATURES - Features contain folder and related file for each feature.

\TEMPLATE\LAYOUTS - Common site pages; maps to /_layouts

\TEMPLATE\IMAGES - Common site image files; maps to /_layouts/images

\TEMPLATE\SiteTemplates - All SharePoint site definitions; create a \xml to deploy your onet.xml custom site definition

\TEMPLATE\THEMES - All UI elements used in themes; clone an existing theme folder to create your own

\TEMPLATE\[LCID]\XML - Webtemp.xml files to define available site definitions; add an xml file here for your custom site definition

\TEMPLATE\ADMIN Pages - Used by Central Admin; maps to /_admin

\ADMISAPI Administration web services; maps to /_vti_adm

Now lets discuss the most commonly used Folder in SharePoint development.

TEMPLATE Folder - The most commonly used folder in 12 hive is the template folder or 12\TEMPLATE\. This is where developers deploy all of there custom files like Custom css, javascript file, Image file, Usercontrol, Custom aspx page, layouts page etc. etc.. These Custom files then run under SharePoint context and can well interact with Out-of-Box sharePoint components.

Now, lets talk about how a wsp (or solution package) interacts with the 12 hive - When you deploy a Solution using stsadm or Visual Studio( using VseWss), SharePoint copies various files from the WSP to the hive. The file responsible in wsp to perform various deployments\copying is the "manifest file".The manifest.xml file specifies how the WSP file is put together.

So, when the deployment starts the sharepoint compiler looks for the first tag i.e the <solution > tag. This tag tells sharepoint about the solution id that uniquely identifies your solution.

Next it looks for the <FeatureManifest> tag. This location however, is virtually mapped to the root of the FEATURES folder at 12 hive i.e to 12\TEMPLATE\FEATURES. So, the SharePoint compiler reads this location and creates a Cutsom Folder usually specified in <FeatureManifest> tag and places the feature.xml file into that folder.

Next it looks for <TemplateFile> tag. This location is virtually mapped to the root of the TEMPLATE folder i.e. at 12\TEMPLATE. This tells compiler to deploy the files specified under this tag, into one or more folder under template directory.

For e.g. if <TemplateFile> tag has location as Location="Layouts\CustomPage.aspx", the installer will drop the file CustomPage.aspx under the Layouts folder, since it is already pointing to the root of the Layouts folder Tempalte folder.

Finally, the installer looks at the <Assemblygt; tag which specifies where the DLL is located. The root for this element is the web application bin file if you specify DeploymentTarget="WebApplication", and the GAC if you specify DeploymentTarget="GlobalAssemblyCache".

While the manifest determines what’s in the WSP file, you still have to create a diamond definition file also known as .ddf file which is an instruction file for building WSP files. However, if you are using VseWSS you will not create all the deployment files manually. The extentions take care of that.

1 comment: