SharePoint deployment is an important topic. I'll continue to update this article to augment any missing points. So, please visit this page once in a while. There are two types of SharePoint deployment. One is Feature deployment based on SharePoint solution packages, aka wsp files. The other is content deployment based on SharePoint Content Deployment.

Featured deployment based on SharePoint Solution Packages

For now, I'll skip explaining how to create a SharePoint solution package. Instead of reinventing wheels, you may take a look at tools which automatically generate wsp files.


Here are a few general tips on creating SharePoint solution packages.


Create multiple SharePoint solution packages

For your project, seriously consider breaking down a SharePoint solution package to multiple ones. By having multiple packages, you can minimize the impact of retracting and redeploying the entire solution. This approach of multiple packages is helpful for a large scale project which requires hot-fix or updates after a deployment. Here is an example:
○ A solution package for common assemblies
○ A solution package for application pages
○ A solution package for an webpart assembly and webpart features
○ A solution package for SharePoint Event Handler features
○ A solution package for SharePoint TimerJob features


Versioning

Don't use versioning except for BDC application definitions. Do not use versioning for web part assemblies especially if you're planning to deploy assemblies to GAC. The reason is that change of versions for web parts will result in confusion to the webparts which are already registered in SharePoint web part galleries. Also, doing so will result in error messages to the original web parts which were previously added to web part pages.


It's better to use versioning for BDC application definitions because with versioning you can simply import a latest BDC application without impacting the previously configured BDC webparts. If you don't use versioning for BDC application definitions, you will end up reconfiguring BDC webparts after importing a latest BDC application definition.


SharePoint solution package is JUST part of deployment

SharePoint solution package is NOT deployment. It is just part of deployment. I would break the deployment process to three processes. They are Pre-build, build and post-build. Deployment of SharePoint solution packages happens during the build process.


Deployment Processes examples:


  • Pre-build (prebuild.bat):
    • Web.config configuration (either a console app or SPWebConfigModifier)
    • Uninstall Features
      • stsadm -o deactivatefeature ...
      • stsadm -o uninstallfeature ...
    • Retract Solutions (*.wsp)
      • stsadm -o retractsolution ...
    • Delete sites, delete SiteGroups, delete Users (clean up)
      • stsadm -o deleteweb ...
      • stsadm -o deletegroup ...
      • stsadm -o deleteuser ...
    • Create sites, create SiteGroups, create Users
      • stsadm -o createweb ...
      • stsadm -o addgroup ...
      • stsadm -o adduser ...
    • Populate custom user profiles (using SharePoint API)
  • Build (build.bat):
    • Deploy Solutions (*.wsp)
      • stsadm -o addsolution ...
      • stsadm -o deploysolution ...
    • Activate Features
      • stsadm -o activatefeature ...
  • Post-build (postbuild.bat):
    • Configuring search property mapping (using SharePoint API)
    • Creating web part pages (Manual process or using SharePoint API)
    • Creating web parts and web part connections (Manual process or using SharePoint API)

Sample script of build.bat

ECHO OFF

SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm"

REM ** Adding solutions
%STSADM% -o addsolution -filename [Path to Solution 1]
%STSADM% -o addsolution -filename [Path to Solution 2]

REM ** Deploy the solution 1
%STSADM% -o deploysolution -name [Solution 1] -immediate -allowGacDeployment -url [url] -force
REM ** Wait for deployment to complete
%STSADM% -o execadmsvcjobs

%STSADM% -o deploysolution -name [Solution 2] -immediate -force
REM ** Wait for the deployment to complete
%STSADM% -o execadmsvcjobs

ECHO Activate features...
%STSADM% -o activatefeature -name [Feature 1] -url [url] -force
%STSADM% -o activatefeature -name [Feature 2] -url [url] -force
...


To automate or not to automate? That's a question.

Well, you can automate everything, but automating everything take time and lots of effort. In general, it makes sense to automate the prebuild and build process. Post Build such as adding web parts to pages and configuring web part properties and connections may better be left as manual process. Then if necessary, you may start to convert some of the time-consuming manual processes to be automated. Using SharePoint feature makes sense in most cases for automation.

Summary

Deployment is a huge topic. As I said at the beginning, I'll update this article continuously. In the meantime, if you're not clear on certain areas, please feel free to contact me. Thank you.

Resources

 


Using Visual Studio 2005, MakeCab.exe and MSBuild to Create Window SharePoint Services v3 Solution Files (*.WSP's): http://www.andrewconnell.com/blog/articles/UsingVisualStudioAndMsBuildToCreateWssSolutions.aspx


Deploy and configure SharePoint sites (Windows SharePoint Services): http://technet2.microsoft.com/windowsserver/WSS/en/library/830c7363-53e9-4039-a6ba-87be0e472e421033.mspx?mfr=true

Deploy in a simple server farm: http://technet2.microsoft.com/windowsserver/WSS/en/library/58d28a34-7a84-4564-a4cb-0e6b5425f67e1033.mspx?mfr=true

SharePoint Solution Package Creation tool: http://www.codeplex.com/wspbuilder

Content Deployment: http://technet.microsoft.com/en-us/library/cc263428.aspx