My name is Atanas Korchev and I am a Product Manager here at telerik. I am involved in the development of r.a.d.controls MCMS Edition and r.a.d.editor SharePoint Edition. On this blog I will be sharing my experience with Microsoft SPS and WSS and Microsoft Content Management Server 2002, as well as anything else I find interesting.

So here it goes… My first entry is about packaging resources for web parts.

Web parts are deployed in most cases as CAB (Microsoft cabinet) files. A developer needs to package all web part files (manifest.xml, dwp files, assemblies or anything else) in a single cab file and distribute it. That file is then passed to the almighty stsadm.exe which installs it in the specified virtual server. That helpful utility does everything you can imagine to your sharepoint implementation. In fact it makes scrambled eggs if you find out the right option.

Cab file projects are supported natively by Visual Studio. There is a “Cab file” setup project which will do just fine for simple web parts. However it lacks one important feature. You cannot package any folders in the resulting file. This was a major showstopper for us because all resources of our components are stored in the famous RadControls folder. Thus we needed another way to put the RadControls folder inside the cab file. After some googling the solution was found – makecab.exe. However using it was not a trivial task. You cannot specify a folder and make it compress everything inside is as with most command line compression tools. Instead you should prepare a .ddf file describing all files and folders which are to be compressed. Here is an excerpt from ours:

.Set CabinetNameTemplate=RadWebParts.cab;
.Set DiskDirectoryTemplate=CDROM ;
.Set CompressionType=MSZIP ;
.Set UniqueFiles="OFF" ;
.Set Cabinet=on ;
.Set DiskDirectoryTemplate="."
.Set MaxDiskSize=CDROM
.Set DestinationDir="RadControls"
.Set DestinationDir="RadControls\Editor"

The first few lines were taken again from google. They set some known and unknown options for the cabinet file:
.Set CabinetNameTemplate=RadWebParts.cab; -> the name of the output file
.Set DiskDirectoryTemplate=CDROM ; -> unknown
.Set CompressionType=MSZIP ; -> should be compression type
.Set UniqueFiles="OFF" ; -> allow duplicate file names
.Set Cabinet=on ; -> unknown
.Set DiskDirectoryTemplate="." -> start folder
.Set MaxDiskSize=CDROM -> yep, uknown

The rests of the lines are automatically generated by a home-grown tool as we are build automation freaks. I strongly recommend you to develop one for your self. The syntax here is more intuitive. First you specify the folder:
.Set DestinationDir="RadControls\Editor"
Then all files in thefolder (mind the path)

When the ddf file is ready (or you believe so) you can run “makecab.exe /F MyCab.ddf”. The output is rather verbose but eventually you would get your cab file ready for deployment. And don’t forget to include Manifest.xml – stsadm.exe will complain if that file is missing.

Ok that’s all for now. I hope it was helpful and I would love to hear your comments on the this and future posts.

About the Author

Atanas Korchev

 is Team Leader in Kendo UI Team

Related Posts


Comments are disabled in preview mode.