Gerald de Run's Blog

SharePoint Visual Studio Project and Deployment Templates

I started using the SharePoint Visual Studio Project Templates from CodePlex and extended the original solution to:

  • Use seperate SharePoint Project and SharePoint Deployment templates; this supports packaging multiple SharePoint Projects (assemblies and artifacts) into a single SharePoint Deployment Package (.wsp file).
  • Modified scripts that generate the manifest.xml and cab.ddf to support packaging additional SharePoint Artifacts (site definitions, root files).

Using these templates on several of my customer engagements has gotten their development teams into the habit of packaging their SharePoint solution properly for deployment.  I have attached the templates and an example using code samples from Inside Microsoft Windows SharePoint Services 3.0.

SharePoint Project Template 

The SharePoint Project template mimics the 12 hive folder structure for working with SharePoint artifact files.  I used 12 as the root folder because certain SharePoint artifact files may live outside the TEMPLATE folder (eg. Resources).
12
|--TEMPLATE
   |--FEATURES
   |--...
|--Resources

I find working with the 12 hive structure far more intuitive than using the Visual Studio 2005 Extensions for Windows SharePoint Services that also does not provide complete control over the generated solution package.  I have used my templates to re-package the code samples from Inside Microsoft Windows SharePoint Services 3.0.

The DLLS folder structure is used for deploying the compiled assembly to the Web Application BIN directory or the Global Assembly Cache and defining <SafeControl> and <CodeAccessSecurity> settings in Web.config for the assembly.
DLLS
|--CodeAccessSecurity
|--GAC
|--SafeControls

  • DLLS: compiled assemblies copied to this folder will be packaged for deployed to the Web Application BIN directory by the SharePoint Deployment project.
  • CodeAccessSecurity: Contents of <CodeAccesSecurity>.xml files in this folder will be added to the solution manifest by the SharePoint Deployment project.
  • GAC: compiled assemblies copied to this folder will be packaged for deployed to the Global Assembly Cache by the SharePoint Deployment project.
  • SafeControls: Contents of <Assembly>.dll.xml files in this folder will be added to the solution manifest by the SharePoint Deployment project.

The SharePoint Project template contains a Post-build event command-line to:

  1. Optionally copy the project output to the DLLS or GAC folder.
  2. Copy the 12 and DLLS folder structure to a SharePoint Deployment project path.

Please review Readme First for how to configure the project template.

SharePoint Deployment Template 

The SharePoint Deployment template contains 2 scripts to automate generation of the solution manifest (manifest.xml) and solution package (.wsp):

  • CreateManifest.vbs: This script creates the solution manifest file by enumerating the 12 and DLLS folder structures.
  • CreateCabDDF.vbs: This script creates the DDF file used to generate the solution package.

The Scripts folder contains deployment scripts that call the Stsadm command-line tool to deploy, upgrade and retract the solution package.  These deployment scripts can be extended to perform additional installation / un-installation tasks required by the solution (e.g. create new site collection using site definition deployed by the solution package).

The SharePoint Deployment template contains a Post-build event command-line to:

  1. Clean-up project output directory; output of SharePoint Deployment is .wsp and deployment scripts.
  2. Execute CreateManifest.vbs to generate solution manifest file (manifest.xml).
  3. Execute CreateCabDDF.vbs to generate DDF file (cab.ddf).
  4. Run makecab.exe to generate the solution package (.wsp).
  5. Copy the deployment scripts to project output directory.

Please review Readme First for how to configure the project template.

Published Friday, January 11, 2008 11:34 AM by gderun

Attachment(s): Templates.zip

Comments

 

Geek Lectures - Things geeks should know about » Blog Archive » SharePoint Visual Studio Project and Deployment Templates said:

January 10, 2008 10:33 PM
 

Tommy Segoro said:

This is the second part of Sharepoint Development using Visual Studio series. For previous part: http

September 7, 2008 9:26 PM
 

rdcpro said:

I like your separate project and deployment folders.  I think I'll adopt that approach myself.  

I do have one suggestion for the CreateManifest and CreateCabDDF scripts from CodePlex;  If someone is using TortoiseSvn, there are .svn folders in the project directory that will mess the packaging up.   So I modified the Codeplex scripts to exclude those folders.  It might be worth excluding any hidden file or folder.

http://www.codeplex.com/CKS/Thread/View.aspx?ThreadId=33325

Regards,

Mike Sharp

March 27, 2009 3:02 PM
Anonymous comments are disabled

© 2010 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker