Friday, April 17, 2009

Steps to Create & Deploy WSP

1) In your custom feature folder, create a file "feature.xml"
Following is the general format of the file:

Title="My Feature"
Description="This is my feature containing a list"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">





(Change the GUID of the feature with your own)


2) Create %YourFeatureName%manifest.xml file for the feature in the following format:


Name="Messages"
Type="108"
BaseType="0"
OnQuickLaunch="FALSE"
FolderCreation="FALSE"
SecurityBits="12"
Sequence="999"
DisplayName="My List"
Description="This is my custom list based on the discussions list"
Image="/_layouts/images/itdisc.gif"/>


3) Create a manifest.xml file for the feature:

SolutionId="EC2EFD73-DBA2-4c0e-9C18-C8FC43F72E6C" >






4) Inside the source folder, create a DDF file:
.OPTION Explicit
.Set DiskDirectory1="..\bin"
.Set CabinetNameTemplate="MyListSolution.wsp"
manifest.xml
; These directory names (DestinationDir) are used for the folders creation under 12\TEMPLATE\Features
.Set DestinationDir="MyList\ListTemplates"
MyList\ListTemplates\MyListManifest.xml
.Set DestinationDir="MyList\Messages"
MyList\Messages\schema.xml
.Set DestinationDir="MyList"
MyList\Feature.xml


5) Create a build.cmd file in the source folder:
build.cmd
@setlocal
@pushd.
@cd %~dp0
makecab /f wsp.ddf
@popd
@endlocal
5) Now, to deploy the solution; create the following steps:
DeployMyListSolution.cmd
@setlocal
@pushd.
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0
stsadm.exe -o addsolution -filename MyListSolution.wsp
stsadm.exe -o deploysolution -name MyListSolution.wsp -local
@pause
@popd
@endlocal


6) After you have deployed the solution, go to Central Adminsitration > Operations > Solution Management. From here, deploy your solution on the web applications you want.

If you want to retract the solution you need to create the following file in the solution
RetractMyListSolution.cmd
@setlocal
@pushd.
@set PATH=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%PATH% @cd %~dp0
stsadm.exe -o retractsolution -name MyListSolution.wsp –local
stsadm.exe -o deletesolution -name MyListSolution.wsp
@pause
@popd
@endlocal


-------------------------------------------------------------------------------------------------------------------------------------------------
If you want to know about the elements used in the above mentioned xml file formats, please view these links:
http://www.theartofsharepoint.com/2007/05/how-to-build-solution-pack-wsp.html
http://www.chrishines.com/techblog/default.aspx
http://msdn.microsoft.com/en-us/library/aa543741.aspx
http://geekswithblogs.net/evgenyblog/archive/2008/01/27/118966.aspx

No comments: