CJ

The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

The anatomy of SharePoint deployments

Posted by Clayton James on February 27, 2008

This is a list of files and their settings that SharePoint uses for its solution deployment process. This process is managed by a number of tools on the market but it is always good to understand what the tools are doing under the covers.

 

Feature File – Feature.xml
<?xml version=1.0 encoding=utf-8?>
<Feature  Id=2D866096-5784-11DC-B668-185D55D89593
          Title=CJ Corporate Directory Feature
          Description=Feature that allows users to find peeople in the Corporate Directory
          Version=1.0.0.0
          Hidden=FALSE
          Scope=Web
          xmlns=http://schemas.microsoft.com/sharepoint/>
  <ElementManifests>
    <ElementManifest Location=element.xml />
  </ElementManifests>
</Feature>

Feature Manifest File – element.xml
This is where the real work for the Feature takes place. Each Feature will have its own element manifest file and is the glue for the Feature. This places the Feature files into locations inside SharePoint.

<Elements xmlns=http://schemas.microsoft.com/sharepoint/>
      <Module Name=CJOrgChart RootWebOnly=TRUE Path=OrgChartXMLTree Url=_catalogs/masterpage/CJCorporateDirectory>
            <File Url=CJTree.aspx IgnoreIfAlreadyExists=TRUE Type=GhostableInLibrary />
            <File Url=tree.xslt IgnoreIfAlreadyExists=TRUE Type=GhostableInLibrary />
      </Module>
    <Module Name=CJImages RootWebOnly=TRUE Path=OrgChartImages Url=_catalogs/masterpage/CJCorporateDirectory>
            <File Url=shim.gif Name=shim.gif IgnoreIfAlreadyExists=TRUE Type=GhostableInLibrary />
      </Module>
      <Module Name=CJStyles RootWebOnly=TRUE Path=Styles Url=Style Library/CJ>
            <File Url=CJStyles.css IgnoreIfAlreadyExists=TRUE Type=GhostableInLibrary />
            <File Url=CJIntranetstyles.css IgnoreIfAlreadyExists=TRUE Type=GhostableInLibrary />
      </Module>
</Elements>

Module
Path: This relates to the physical location relative to the Feature being installed. OrgChart is pointing to OrgChartXMLTree so in the feature CorporateDirectory there is a folder OrgChart with a sub folder XMLTree.
Url: This is the virtual path for the physical files. The physical files will be located in sub folders in the FEATURESCorporateDirectory feature.

File
Url: This relates to the virtual file.


Solution Manifest File – Manifest.xml
This file points to the Feature definition and identifies the physical location of the deployed files and allows GAC/Bin deployment with SafeControl entries.

TemplateFile Location
The Location attribute must create the directories and copy the file into these directories. It is relative to the /TEMPLATE folder. I thought that this should all be handled in the Feature but it wasn’t the case. I tested this by removing the shim.gif and the feature failed on activation Failed to instantiate file “shim.gif” from module “CJImages”: Source path “OrgChartImagesshim.gif” not found. And there was no images directory under my FeatureOrgChart directory.

 

<?xml version=1.0 encoding=utf-8 ?>
<Solution xmlns=http://schemas.microsoft.com/sharepoint/ SolutionId={93D784D4-A5C1-4ee0-84C2-F6E3894FA45E}DeploymentServerType=WebFrontEndResetWebServer=TRUE >
  <FeatureManifests>
    <FeatureManifest Location=CJCorporateDirectoryfeature.xml />
  </FeatureManifests>
  <TemplateFiles>
    <TemplateFile Location=LAYOUTSCJCorporateDirectoryPersonalSkillsPicker.aspx/>
    <TemplateFile Location=LAYOUTSCJCorporateDirectorySkillsPicker.aspx/>
    <TemplateFile Location=FEATURESCJCorporateDirectoryOrgChartXMLTreeCJTree.aspx />
    <TemplateFile Location=FEATURESCJCorporateDirectoryOrgChartXMLTreetree.xslt />
    <TemplateFile Location=FEATURESCJCorporateDirectoryOrgChartImagesshim.gif />
    <TemplateFile Location=FEATURESCJCorporateDirectoryStylesCJIntranetstyles.css />
    <TemplateFile Location=FEATURESCJCorporateDirectoryStylesCJStyles.css />
  </TemplateFiles>
  <Assemblies>
    <Assembly DeploymentTarget=WebApplication Location=“”>
            <SafeControls>
                    <SafeControl Assembly=“” Namespace=“” TypeName=“” Safe=TRUE/>
            </SafeControls>
        </Assembly>
    <Assembly DeploymentTarget=GlobalAssemblyCache Location=CJ.SharePoint.Intranet.CorporateDirectory.UI.dll />
  </Assemblies>
</Solution>


Directive Definition File – wsp_structure.ddf
;
;
.OPTION EXPLICIT     ; Generate errors
.Set CabinetNameTemplate=CJ.SharePoint.Intranet.CorporateDirectory.UI.wsp
.set DiskDirectoryTemplate=CDROM ; All cabinets go in a single directory
.Set CompressionType=MSZIP;** All files are compressed in cabinet files
.Set UniqueFiles=”ON”
.Set Cabinet=on
.Set DiskDirectory1=Package
“manifest.xml”  manifest.xml
“..TEMPLATEFEATURESCJCorporateDirectoryfeature.xml” CJCorporateDirectoryfeature.xml
“..TEMPLATEFEATURESCJCorporateDirectoryelement.xml” CJCorporateDirectoryelement.xml
“..TEMPLATEFEATURESCJCorporateDirectoryOrgChartXMLTreeCJTree.aspx” FEATURESCJCorporateDirectoryOrgChartXMLTreeCJTree.aspx
“..TEMPLATEFEATURESCJCorporateDirectoryOrgChartXMLTreetree.xslt” FEATURESCJCorporateDirectoryOrgChartXMLTreetree.xslt
“..TEMPLATEFEATURESCJCorporateDirectoryOrgChartImagesshim.gif” FEATURESCJCorporateDirectoryOrgChartImagesshim.gif
“..TEMPLATEFEATURESCJCorporateDirectoryStylesCJIntranetstyles.css” FEATURESCJCorporateDirectoryStylesCJIntranetstyles.css
“..TEMPLATEFEATURESCJCorporateDirectoryStylesCJStyles.css” FEATURESCJCorporateDirectoryStylesCJStyles.css
“..TEMPLATELAYOUTSCJCorporateDirectoryPersonalSkillsPicker.aspx” LAYOUTSCJCorporateDirectoryPersonalSkillsPicker.aspx
“..TEMPLATELAYOUTSCJCorporateDirectorySkillsPicker.aspx” LAYOUTSCJCorporateDirectorySkillsPicker.aspx
“..bindebugCJ.SharePoint.Intranet.CorporateDirectory.UI.dll”      CJ.SharePoint.Intranet.CorporateDirectory.UI.dll 


Create Solution – .wsp
This command creates the .wsp file for deployment.
set MakeCabTool=c:Program FilesMicrosoft Visual Studio 8SmartDevicesSDKSDKToolsmakecab.exe
“%MakeCabTool%” -f wsp_structure.DDF


Install Solution – wsp_install.bat
Deploying it using a .bat file. Need to include the activate feature command as this is not automated when deploying solutions.

set SPAdminTool=%CommonProgramFiles%Microsoft Sharedweb server extensions12BINstsadm.exe
echo installing the CJ.SharePoint.Intranet.CorporateDirectory.UI Solution…

“%SPAdminTool%” -o addsolution -filename PackageCJ.SharePoint.Intranet.CorporateDirectory.UI.wsp
“%SPAdminTool%” -o deploysolution -immediate -allowGacDeployment -name CJ.SharePoint.Intranet.CorporateDirectory.UI.wsp
“%SPAdminTool%” -o execadmsvcjobs

“%SPAdminTool%” -o activatefeature -filename CorporateDirectoryfeature.xml -url http://intranet -force

echo Doing an iisreset…
popd
iisreset

 

Project Structure
This was all created manually.

clip_image002

 

Deployment Structure

clip_image004

 

Problems
One thing that I haven’t found is a way to automatically activate a feature when deploying a solution. Yes it can be completed using stsadm but if I give a .wsp file to the admin team to install/update feature then this needs to be a two step process.

1/ Deploy .wsp
2/ Deactivate/Reactivate Feature

This has caused me headaches as modified files do not get updated until you go through a manual process and activate the feature or use stsadm.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: