Friday, August 22, 2008

Command line for SharePoint Solution Generator

Make sure Environment variable PATH is set for stsadm.exe

How to use it
1. Build the Visual Studio Project you got from SharePoint Solution Generator
2. Download WSPBuilder from http://www.codeplex.com/wspbuilder
3. Extract all the file next to Visual Studio Project file.
4. Copy the below script into a command line batch file next to the Visual Studio Project file.

Script:

rmdir 12 /Q /S
rmdir GAC /Q /S

set /P solutionname="Enter solution name :"

xcopy bin\debug\solution\*.dll GAC\*.* /S

xcopy bin\debug\solution\1033\xml\*.* 12\TEMPLATE\1033\xml\*.* /S

xcopy bin\debug\solution\%solutionname%\xml\*.* 12\TEMPLATE\SiteTemplates\%solutionname%\xml\*.* /S

xcopy bin\debug\solution\*.* 12\TEMPLATE\FEATURES\*.* /S

del 12\TEMPLATE\FEATURES\*.dll
del 12\TEMPLATE\FEATURES\*.xml

rmdir 12\TEMPLATE\FEATURES\%solutionname% /Q /S
rmdir 12\TEMPLATE\FEATURES\1033\ /Q /S
pause

5. Run the following command line
set /P solutionname="Enter solution name :"

stsadm -o retractsolution -name %solutionname%.wsp -allcontenturls -immediate
stsadm -o execadmsvcjobs
stsadm -o deletesolution -name %solutionname%.wsp

del *.wsp
del solutionid.txt
wspbuilder
ren Buildx86.wsp %solutionname%.wsp

stsadm -o addsolution -filename %solutionname%.wsp
stsadm -o deploysolution -name %solutionname%.wsp -allowGacDeployment -allcontenturls -immediate
stsadm -o execadmsvcjobs

0 comments: