Monday, April 29, 2013

Deploy solutions in share point 2013

SharePoint 2013 supports backward compatibility, for the sites created in SharePoint 2010. We can achieve this by using 14 layout folder. In SharePoint 2013 server we can have both 14 and 15 layout folders
If we want same features in SharePoint 2010 as well as 2013, we need to use SharePoint product version for solution properties. In the image below we are assigning 15 for SharePoint Product version. Means solution will deployed to 15 folder.

manifest.xml file shown below, here I have set the SharepointProductVersion as 15, so that file will deployed to 15 folder.

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="7b9510ed-0926-4692-8afd-76fe5f629b00" SharePointProductVersion="15.0">
  <Assemblies>
    <Assembly Location="MySharepointProject.dll" DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Assembly="$SharePoint.Project.AssemblyFullName$" Namespace="MySharepointProject" TypeName="*" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <FeatureManifests>
    <FeatureManifest Location="MySharepointProject_Feature1\Feature.xml" />
  </FeatureManifests>
</Solution>

By deploying through stsadm commands Install-SPSolution command, we have a new parameter called CompatabilityLevel. By providing the options to compatabilty parameter we can specify the deployment target. CompatabilityLevel is an optional parameter. If we are not specified any value, deployment target will depends on solution cabinet manifest.xml file. Install Solution command only deploys the installed solution in SharePoint server.
Following are the options for compatabilityLevel parameter.

14” -> Installs solution in 14 hive
15” -> installs solution in 15 hive
14,15” -> Installs solution to both 14 and 15 directories
AllVersions” or “All” -> Installs solution to both 14 and 15 directories
OldVersions” or “Old” -> Installs solution to 14 directories only
NewVersion” or “New” -> Installs solution to 15 directories only

Share this