Stuck Deployments in SharePoint 2013

Fun times! Im trying to get around the restriction that Sharepoint doesnt allow Cross-Frame scripting so that I can display a PDF on my CRM installation.

Long story... anyway, today I deployed a new package to my Sharepoint 2013 server without checking if the Sharepoint Administration service was running. This caused Sharepoint to make the deployment job, but just leave it pending.

If you try to deploy again, you get this error;

A deployment or retraction is already under way for the solution 

Then I stumbled upon this little gem from Geeks With Blogs. Very useful - thanks! (Blog entry: A deployment or retraction is already under way for the solution "xxx.wsp", and only one deployment or retraction at a time is supported)

First get the path to your STSADM command. You will need this in the CMD or Powershell interface.

Usually %COMMONFILES%\Microsoft Shared\web server extensions\12\BIN (12 denotes version so could be different for you).

Then use these commands:

  • Check current deployment jobs:
stsadm-o enumdeployments 
  • Copy the ID number and the use this to cancel the deployment job
stsadm-o canceldeployment-id "GUID jobId" 

You can then use the enumdeployments to check it is now empty.