Monday, 29 June 2009

Delete Error WSP Solution from Solution Store

Removing malfunctioning Windows SharePoint Services solutions
I got this fantastic article from i would share it for all.

It could happen that you (or whatever) accidentally break a deployed solution on a Windows SharePoint Services 3.0 (or MOSS 2007 for that matter) farm or site. If that happens, you can no longer retract and/or remove a solution by using the Operations part of the Central Administration website. It will show up as an error in the list of solutions under "Solution Management".
So how do you go about removing the solution entirely? You can use the command-line tool STSADM.exe which can be found under "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN" for a normal installation of WSS 3.0. Let's assume that the malfunctioning solution is called HelloWorldWebPart.wsp.
To see a list of all solutions that are on the server run the enumsolutions operation. Operations are the commands that STSADM.exe will take after the -o command-line argument. This is the way you run all operations. If you need help on a particular one, call STSADM.exe -help operationname.

Like in the output above, the solution (even if malfunctioning) could be deployed. You will need to retract the solution first. This is where you probably run into trouble. When you run the operation retractsolution like this:

Two things can happen at this point: you either panic or stay cool (or panic in a cool way). Should panic kick in, you probably will try to still forcibly delete the solution by running the deletesolution operation anyway.

Oh no, what to do now? Calm down. Run an enumeration over the scheduled deployments (retractions are considered deployments as well)

The JobId attribute of the deployment gives the GUID for the job that was scheduled but could not run. You can stop the scheduled retraction by running the operation canceldeployment (again, it's not cancelretraction).
stsadm -o canceldeployment -id 2529c788-971c-46a3-b69f-a2a0a1fcc851
At this point the scheduled retraction should be gone, which you can verify by using enumdeployments again.
Now you can read the message of the retractsolution operation again. You would have done so anyway if you just remained calm. The message says that the WSS Administration service hasn't been started yet. Not that strange, since by default it is configured to start manually.

Start the service and run the execadmsvcjobs operation to run all scheduled jobs.

There you go, no more deployed solution. Now it is just a matter of removing the solution. You can try using the Central Administation website again, because usually the error on the solution has disappeared.

Otherwise, run the deletesolution operation in STSADM.