Matthew Knott

Previous: Been a while
Next: iPhone developing on hold. Desktop proceeding

Deploying SharePoint 2007 Webparts

Posted on Thursday, 31 July 2008 08:26

 

This article is aimed at those developers who've developed their own SharePoint 2007 webparts in Visual Studio using the wss sdk and want to deploy them to a different server.

1. Build it

The first step is to do a standard Visual Studio deployment of your webpart (F5 or the play button). Once this has happened go to the project folder, then the bin > debug folder.


2. Take it

In here you should have a file along the lines of my_projects.wsp. Take this file and copy it to a folder on one of the web front ends you are deploying on.


3. Script it

Next you need to create two files in the same folder ideally as your .wsp file.

Create a new text document and call it DeploySolution.cmd, then add the following lines to it, replacing my_solution.wsp with your solution name.

 

@setlocal
@pushd.

@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH% @cd %~dp0

stsadm.exe -o addsolution -filename my_solution.wsp
stsadm.exe -o deploysolution -name my_solution.wsp -allcontenturls -allowGacDeployment -immediate
stsadm.exe -o execadmsvcjobs

@pause
@popd
@endlocal

 

Once you have done that, create another text document and call it RetractSolution.cmd, then add the following lines to it, again, replacing my_solution.wsp with your solution name.

 

@setlocal
@pushd.

@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH% @cd %~dp0

stsadm.exe -o retractsolution -name my_solution.wsp -local -allcontenturls -immediate
stsadm.exe -o deletesolution -name my_solution.wsp
stsadm.exe -o execadmsvcjobs

@pause
@popd
@endlocal

 

Use the first script to deploy your solutions on the server. If you need to update the solution, first use the retract solution script, then re-run the deployment script.

Once you've run the script, you'll most likely have to go into Site Settings > Site Collection Features and turn on the webpart.

Comments

No comments have been added.

Add a comment