SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder with following structure, I wonder how can I create a wsp file for it, and it deploy the site definition for me,


 - XML
 - -> ONET.xml
 - default.aspx
 - MasterPage.master
 - masterpageajax.master


share|improve this question
up vote 3 down vote accepted

You need to create manifest.xml:

<?xml version="1.0"?>
<Solution SolutionId="876a627d-7944-4c3e-a17f-d347e9234517" xmlns="">
    <SiteDefinitionManifest Location="MySiteDef">
      <WebTempFile Location="1033\XML\webtempMySiteDef.xml" />

And you need to create a cab.ddf:

.OPTION EXPLICIT                    ; Generate errors on variable typos
.Set CabinetNameTemplate=SiteDef.wsp        ; The name of the WSP file
.set DiskDirectoryTemplate=CDROM    ; All cabinets go in a single directory
.Set CompressionType=MSZIP          ; 
.Set Cabinet=on                     ; 
.Set Compress=on                    ;
.Set DiskDirectory1=.               ; Use the specified directory for the output CAB file 
;*** Disable size limits for wsp (cab) files ;
.Set CabinetFileCountThreshold=0 
.Set FolderFileCountThreshold=0 
.Set FolderSizeThreshold=0 
.Set MaxCabinetSize=0 
.Set MaxDiskFileCount=0
.Set MaxDiskSize=0
;*** Files to zip                   ;
"C:\Work\MySiteDef\12\template\1033\XML\webtempMySiteDef.xml" "1033\XML\webtempMySiteDef.xml"
"C:\Work\MySiteDef\12\template\sitetemplates\MySiteDef\default.aspx" "MySiteDef\default.aspx"
"C:\Work\MySiteDef\12\template\sitetemplates\MySiteDef\masterpage.master" "MySiteDef\masterpage.master"
"C:\Work\MySiteDef\12\template\sitetemplates\MySiteDef\masterpageajax.master" "MySiteDef\masterpageajax.master"
"C:\Work\MySiteDef\12\template\sitetemplates\MySiteDef\XML\onet.xml" "MySiteDef\XML\onet.xml"
"C:\Work\MySiteDef\manifest.xml" "manifest.xml"

And then you need to run makecab:

makecab -f cab.ddf

share|improve this answer
thanks for the answer Per, I was wondering do I have to create a WEBTEMP file myself and copy it into 1033\XML\... or there is any other way, as i dont think if its a safe practice, what you reckon :), cheers – Muhammad Raja May 14 '12 at 13:06
Yes, you have to create a webtemp file and copy it into 1033\XML (and any other language you wan't to support) using the WSP. The filename has to start with webtemp and have extension .xml. It has to go into that exact folder no subfolder. And you have to give your Site Definition a unique id in the webtemp. That unique it is an integer > 10000 and if you give the same number as one of the other Site Definitions in the farm one of the stop working. Site Definitions are the worst part left in SharePoint, when you get to SP2010 you'll often want to use WebTemplates instead. – Per Jakobsen May 14 '12 at 13:13
thanks for explanation, but dunno why when i click on Makecab.CMD, it just keeps repeating the same line and doesn't do anything, "directory to the folder > makecab -f cab.ddf" dunno why :( – Muhammad Raja May 14 '12 at 14:51
Try finding makecab.exe and run it from a command line. The Visual Studio Command Prompt should have it in the path. Always run it from an open command prompt as it's very easy to make a mistake in the cab.ddf. – Per Jakobsen May 14 '12 at 16:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.