I've been fielding a lot of questions by clients and coworkers lately related to solutions packages so I thought it was a good topic to touch on in my blog as well . Solutions packages are a new feature (not to be confused with upper case Features) in WSS 3.0 (and therefor MOSS as well) that allows content to be distributed across a SharePoint farm. This content can include any files such as binaries, Features, modules, files, and even web.config updates and can be scheduled to deploy across your SharePoint server farm. This replaced the often tedious and error prone deployment sceneries in the previous version of SharePoint that often manual copying of files and updating of web.config across several servers or purchasing third party deployment tools.

The solution package is a actually just a cab file with a wsp extension that contains all the files along side a XML based manifest file that defines how SharePoint should act upon the files. The cab files is generated with a command line utility called makecab.exe (makecab allows for the defining of folders in a cab file) and then deployed to SharePoint via either STSADM or SharePoint Central Administration.

The general steps of solution package creation and deployment include (*** Images copied from MSDN Article found at http://msdn2.microsoft.com/en-us/library/bb466225.aspx):

1) Create a DDF (Diamond Directive File). This file defines the contents and the structure of a cab file:

image ***

2) Create a solution manifest

image ***

3) Compile wsp with makecab

makecab /f solution\cab.ddf

4) Add the solution to your farm

stsadm -o addsolution -filename solutionfile.wsp

5) Deploy the solution to your target application (or farm)

stsadm -o deploysolution -name solutionfile.wsp -immediate

As you can see its a very manual process, especially with the manual creation of the DDF and manifest files that isn't very efficient, can be error prone, and screams out for some automation. I won't belabor the details of solution package creation as its a well documentation and blogged about topic but if you're looking for more details on the basic concepts behind solution packages check out Ted Pattison's web cast on building solution packages .

Many developers out there have also recognized this as an opportunity to build some tools to support this process. The following are some of the tools\techniques that I've found and experimented with along the way, but before you start playing with any of the them be sure you have a solid understanding of how to build solutions manually as none of the tools are perfect and its very helpful to understand the plumbing when things don't turn out as expected.

Visual Studio Extensions for Windows Sharepoint Services 3.0 (VSeWSS)

VSeWSS was released by Microsoft last year and provides a set of new project types for SharePoint specific entities such  such as webparts, site definitions, list definitions.  In addition to some improved designer and debugging support it also generates wsp packages and can automatically deploy those packages to a local SharePoint instance. One of the great aspects of these new visual studio projects is that they transparently take care of all the aspects of solution package creation. One of the most annoying aspects is that it transparently takes care of all the aspects of solution package creation (ok some of the files are just hidden). It's a blessing and a curse because it doesn't really give you much of an easy opportunity for customizing or working against the solution package directly. There are a few other aspects not related to solution package creation that annoy me about VSeWSS so I have chosen not to use it on a regular basis but your mileage may vary and I'd recommend at least checking it out. Some people have had good success with using it and feel it shines in many sceneries.  It can be downloaded from Microsoft.

Custom MSBuild Targets

This was actually one of the first techniques I used during SharePoint Betas and has also been widely discussed (see Andrew Connell's discussion). Behind the scenes Visual Studio 2005 uses a build solution called MSBuild. You may have had experience with other build tools such as nant and this is very much akin to that category of build tools. It quite extensible where you can add your own custom steps to the build process from simple out of the box command line execution to custom targets (think functions). Although this technique does not necessarily provide any automation to the ddf and manifest creation it allows for other types of automation to be built into the build process achieving "F5" support for automation (not necessarily debugging though). It can really shine if you combine it with other techniques to automate your DDF & manifest file creation as it gives you the best of both worlds by giving you a lot of flexibility in how\when things are built in the MSBuild. I currently use this technique in most of my projects. Erik Kraus has a nice article on using this technique that builds on some posts by Ted Pattison and Andrew Connell to also include the actual deployment of the wsp files to a SharePoint site during the build process.

 

WSP Builder

WSP Builder is a project found on codeplex that provides automation of the creation of the ddf, manifest, and wsp files (see a common theme here?). WSP Builder is a console application that makes some expectations\requirements on the folder structure within you're project to identify how to properly build the manifest file. I haven't used it since a very early release but it looks to have a lot of promise with some visual studio addin capabilities and wizards coming down the pike. At first I didn't like the forced project structure, the project structure forces the same structure as the 12 hive (including the 12 folder), but for what you get it's probably a good exchange.  I'm going to keep an eye on this project and I'll be downloading the latest bits soon. I'll pass on my findings.

 

There are likely other tools out there. If you have one that you've worked with that I didn't list I'd love to hear about it and how it well it worked for you. On a last note it's worth mentioning that while I was attending a presentation by Andrew Connell at SharePoint Connections a couple weeks back he showed a Visual Studio plug-in for DDF, Manifest, WSP creation that looked very promising. He hasn't released it yet but keep an eye out for that as well.