WSS/MOSS deployment packages are nothing but the CAB files which are created by the MakeCAB tool. We have been using MakeCAB for creating the WSP file for our project and it works like a charm.

Today, I recreated the WSP package for the project we are working on and realized that instead of generating one of each of the output files (.inf, .rpt and .wsp file) it generated more than one .wsp files; all in all, I ended up having the following files in the output folder.

Figure 1. More than one .wsp files generated by MakCAB.

The folder named 681984000 was also created with another .wsp file in it which was around 1300 KB in size!

Before going further, let's see the output files generated by the MakeCAB. The MakeCAB generates different files but the two important files are setup.rpt and setup.inf.

The setup.rpt contains the information about the total files included in the cab files, how much data was compressed, time taken to compress the data, and so on. The following is the setup.rpt file which was created on my development machine.

Figure 2. setup.rpt generated by MakCAB.

The setup.inf file contains information about the disks and the cabinet files which were created and also contains the list of all of the files which were included in each cabinet file. See below.

Figure 3. setup.inf generated by MakCAB.

The above setup.inf specifies that there were two disks/cabinet files created. Similarly each and every file which was included in the cabinet file has the numbers like 1,1 and 2,2 prefixed to it. That specifies which disk/cabinet file contains that particular file! In this case, some of the files went into first cabinet file whereas the other files (including the manifest.xml) went into the second cabinet file.

So going back to my problem of having more than one .wsp files, in the past the same project generated one .wsp file! I was wondering why it generated more than one files this time around and even if it did, how more than one wsp files would play with WSS/MOSS.

I gave it a whirl anyways! Running the addsolution command against stsadm returned the following error. Obviously it was looking for the manifest.xml file in the root Project.wsp but it could not find manifest.xml in that file because the manifest.xml file was included in the second .wsp file which in turn was in the 68198400 folder! – This happened because MakeCAB places files on disks (and in cabinets) in the order they are specified in the directive file(s).

Figure 4. Adding the Project.wsp to MOSS failed!

I changed the Project.ddf file and listed the manifest.xml file @ the top of the list of files to make it go in the first .wsp file, re-created the WSP package again; again it generated more than one files (which was expected) but this time around the manifest.xml file was included in the root Project.wsp file! I ran the above stsadm command again to see how it works this time but it generated the same error even though the manifest.xml file was part of the root Project.wsp!

So that means WSS/MOSS don't play well with more than .wsp files!

What should we do? First we need to find out why MakeCAB was generating more than one file and then somehow make it to generate only one .wsp file with all of the project files in it.

CAB Directives

I dig around the makecab SDK and found the "Make Cab User Guide" which explained how to use the MakeCAB and most importantly how to customize its behavior. While reading through the user guide, I found the following statement in it: The MakeCAB defaults are configured for a floppy disk layout ….

That was it! It did not take me long to realize that the first of the two .wsp files generated by the MakeCAB was around 1.4 MB (See Figure 1 above), which is the maximum size supported by a floppy disk! That means while processing the .ddf file of the project, MakeCAB created the first .wsp file and when the size limit reached, it started to create the next file!

I had the answer to my first question. More than one file was generated because the output cabinet file size was more than the default size of 1.44 MB.

How to fix it? Read on.

The CAB files are driven by the "CAB Directives" which are listed @ the top of the .ddf file and which govern the behavior of MakeCAB. Since we did not use any specific CAB directive in our .ddf file except the CabinetNameTemplate and DiskDirectory1 that means the MakeCAB used default values for the other settings. Which CAB directive to change?

Some of the important CAB directives are listed below along with their purpose and the default value.

Directive

Purpose

Default Value

CabinetNameTemplate

This string template is used to generate the cabinet files names; * is replaced by Cabinet number. If you are generating one cabinet file, specify the actual file name here.

 

CabinetFileCountThreshold

Specifies the threshold count of files per cabinet.

 

If you want to limit the number of files that should be added to the cabinet file then specify that limit here.

Unlimited

FolderFileCountThreshold

Specifies the threshold count of files per folder.

 

If you want to limit the number of files that should be added to the folder in your cab file then specify that limit here.

Unlimited

MaxDiskSize

Specifies the maximum size of the disk.

 

This directive may contain one of the following special values: CDROM, 1.44M, 1.2M, 720K, 360K

1.44M

MaxCabinetSize

Specifies the maximum cabinet file size for current cabinet.

MaxDiskSize

FolderSizeThreshold

Specifies the threshold folder size for current folder.

MaxCabinetSize

 

It was a no brainer once I read the above directives; I had to increase the MaxCabinetSize; since the default value of MaxCabinetSize is same as that of the MaxDiskSize, then I decided to change the MaxDiskSize directive instead and added the following line in the .ddf file of the project.

.Set MaxDiskSize=CDROM

This time around the output of the MakeCAB was only one .wsp file with all of the project files inside it. See below – note the size of the .wsp file; it is more than 1.4 MB which means it contains all of the project files.

Figure 5. Only one .wsp file generated by MakeCAB after changing the .ddf file