Project Description
Command Line utility that generates the .DDF cabinet description and the manifest.xml for a .WSP package (SharePoint Solution Package) in a Visual Studio WSS Feature project.


Overview
SharePoint features can be packaged into .WSP solution packages, defining a .DDF cabinet description file and a WSP solution package manifest (manifest.xml). These files can be hard to maintain when the feature is large and contains many files. This tool generates these files automatically, based on the Visual Studio project folder structure.

Usage Sample
Considering a sample feature named "MyLayouts" containing the following files:

TEMPLATE\FEATURES\MyLayouts\Elements.xml
TEMPLATE\FEATURES\MyLayouts\Feature.xml
TEMPLATE\FEATURES\MyLayouts\MasterPages\My.master
TEMPLATE\FEATURES\MyLayouts\PageLayouts\MyPageLayout.aspx
TEMPLATE\THEMES\MyTheme\some_image.gif
TEMPLATE\THEMES\MyTheme\theme.css


Paths within the Visual Studio project are similar to the relative paths those files will have after the feature has been deployed in SharePoint; the root folder for SharePoint is C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\

The SharePoint Feature Packager will generate two fles:

DeploymentFiles\manifest.xml
DeploymentFiles\wsp_structure.ddf


manifest.xml

<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="{39ecc160-6972-4d91-b087-36d1cc4c22e4}">
  <Assemblies>
    <Assembly DeploymentTarget="GlobalAssemblyCache" Location="MyLayouts.dll">
      <SafeControls>
        <SafeControl Assembly="MyLayouts, Version=0.0.0.0, Culture=neutral, PublicKeyToken=fdbb826620f7bc16" Namespace="MyLayouts" TypeName="*" Safe="True" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <FeatureManifests>
    <FeatureManifest Location="MyLayouts\Feature.xml" />
  </FeatureManifests>
  <TemplateFiles>
    <TemplateFile Location="FEATURES\MyLayouts\MasterPages\My.master" />
    <TemplateFile Location="FEATURES\MyLayouts\PageLayouts\MyPageLayout.aspx" />
    <TemplateFile Location="THEMES\MyTheme\some_image.gif" />
    <TemplateFile Location="THEMES\MyTheme\theme.css" />
  </TemplateFiles>
</Solution>


wsp_structure.ddf

.OPTION EXPLICIT     ; Generate errors
.Set CabinetNameTemplate="MyLayouts.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"

;CAB MANIFEST
..\..\DeploymentFiles\manifest.xml

;ASSEMBLY
MyLayouts.dll

;FEATURE MANIFEST
.Set DestinationDir=MyLayouts
..\..\TEMPLATE\FEATURES\MyLayouts\Elements.xml
..\..\TEMPLATE\FEATURES\MyLayouts\Feature.xml

.Set DestinationDir=FEATURES\MyLayouts\MasterPages
..\..\TEMPLATE\FEATURES\MyLayouts\MasterPages\My.master

.Set DestinationDir=FEATURES\MyLayouts\PageLayouts
..\..\TEMPLATE\FEATURES\MyLayouts\PageLayouts\MyPageLayout.aspx

.Set DestinationDir=THEMES\MyTheme
..\..\TEMPLATE\THEMES\MyTheme\some_image.gif
..\..\TEMPLATE\THEMES\MyTheme\theme.css


You can then add batch file DeploymentFiles\PostBuildActions.bat and set the project Post Build Event as:

call "$(ProjectDir)\DeploymentFiles\PostBuildActions.bat" "$(ConfigurationName)" "$(ProjectDir)" "$(ProjectName)" "$(TargetDir)" "$(TargetName)" DEPLOY


You can find a sample PostBuildActions.bat at http://www.sharepointblogs.com/michael/archive/2007/07/06/sharepoint-solution-deployment-handy-post-build-events.aspx

Finally, build your project in Release mode. The Post Build event will automatically pack the feature into .WSP package and install it on SharePoint.

Run the SharePoint Feature Packager again whenever you add or remove files to the feature project.


Syntax

The syntax for WSSFeaturePackager is:

WSSFeaturePackager [feature-name] [project-root-folder] [solution-guid]


Sample:

MyLayouts "C:\Projects\MyLayouts.root\MyLayouts" {BB330A34-AC12-4ffa-8076-2ECFBD7B11FF}


Last edited Sep 27, 2007 at 3:09 PM by aribeiroms, version 12