Building and deploying Sharepoint cab files with NAnt

Automatically building and deploying cab files for sharepoint is a great efficiency booster. I have previously blogged about my simple, yet effective, autodeployer for sharepoint cabs. This time around I wanted to automate the construction of the cabfile itself and deploying it to the sharepoint testserver. The pseudo code for the build/deploy steps are something like this:

1. Build your webpart assembly with csc.
2. Create a temp folder and copy the dll, dwp files and manifest exe into it.
3. Create and copy a makecab.exe defs file (.ddf) into the temp directory.
4. Run \windows\system32\makecab.exe /F defs.ddf in the temp directory
5. Run stsadm -o addwppack -filename cabfile.cab -force from the tempdirectory (given that the script is running on the SPS test server)

The clue is to get the defs file right. Check out this article on MSDN (section Using MakeCAB.exe). Set the DiskDirectory1 value to . (period) and make sure to remove the extra line in the sample with the word "directory".

Next off is to use Kris Syverstads Sharepoint tasks to slap your webparts up on a testsite for visual testing.

No Comments