How to create wsp from ddf and copy it to 12 hive bin on Project build – SharePoint 2007

If you want to create a .wsp or solution file from your ddf and also add it to 12 hive’s Bin folder all when you build your project, all you need to do is write some commands in .Bat file and add it to the project build events.

So the Steps would be

1. Add a new file with .Bat extension, for e.g. Setup.Bat in your project.
2. Add the following in your .Bat file

@SET MakeCabTool=makecab.exe
@SET DESTDIR=”C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN”
@SET SPAdminTool=%CommonProgramFiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe
if EXIST Package\%WSP%.wsp del Package\%WSP%.wsp
“%MakeCabTool%” /f {DDF FILE.DDF} /D CabinetNameTemplate=Package\%WSP%.wsp
if EXIST Package\ del Package\
“%MakeCabTool%” /f {DDF FILE.DDF} /D CabinetNameTemplate=Package\
XCOPY /r /y Package\*.wsp %DESTDIR%

3. Once done, set the BuildEvents in project properties like below