Tuesday, 8 May 2012

How to deploy the SharePoint 2010 custom solution

  1. Build your project
  2. Right click your project and select package
  3. You can see the .dll file, .wsp file and .pdb file under the bin/debug folder copy those thing and paste the folder which you are going to provide the solution to the client.
  4. create batch file named 'setup2010.bat' or your wish
  5. Write the following code
  6. SET STSADM="c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"
    %STSADM% -o retractsolution -name "solutionname.wsp" -immediate
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deletesolution -name "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o addsolution -filename "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deploysolution -name "solutionname.wsp" -immediate -allowGacDeployment -allowCasPolicies -force
    %STSADM% -o execadmsvcjobs
  7. Here I use the site scope so am not going to all content urls if you use webscope at the time you must be add like following
     SET STSADM="c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"
    %STSADM% -o retractsolution -name "solutionname.wsp" -immediate -allcontenturls
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deletesolution -name "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o addsolution -filename "solutionname.wsp"
    %STSADM% -o execadmsvcjobs
    %STSADM% -o deploysolution -name "solutionname.wsp" -immediate -allcontenturls  -allowGacDeployment -allowCasPolicies -force
    %STSADM% -o execadmsvcjobs
Execute it in the client side
 Happy Coding:)