Resolving: ‘the app for SharePoint is in an invalid state and cannot be uninstalled’

I was having a problem with deploying my SharePoint Hosted App into my Dev SharePoint environment. Where it just kept waiting for the removal to complete and clearly after 15 minutes wasn’t going to. There is no cancel or stop button in Visual Studio so I had to take matters into my own hands by forcing restarting IIS and finally Visual Studio stopped trying.

Then this came up in Visual Studio…

image

Error    1    Skipping the uninstall step because the app for SharePoint is in an invalid state and cannot be uninstalled.
        0    0   

Error    2    Error occurred in deployment step ‘Install app for SharePoint’: The provided App differs from another App with the same version and product ID.
        0    0    UbertTaskListAngularApp

Unfortunately there was also no force remove or stop remove in SharePoint either!

image

So I tried to force the deployment by incrementing my App Manfiest Version value based on a recommendation by Leon Zandman on a previous blog post I’d written on this subject here.

image

and then got this error

—— Build started: Project: UbertTaskListAngularApp, Configuration: Debug Any CPU ——
  Successfully created package at: c:\tfs\demos\UbertTaskListAngularApp\UbertTaskListAngularApp\bin\Debug\UbertTaskListAngularApp.debugapp
—— Deploy started: Project: UbertTaskListAngularApp, Configuration: Debug Any CPU ——
Active Deployment Configuration: Deploy App for SharePoint
  Skipping deployment step because a pre-deployment command is not specified.
  Skipping the uninstall step because the app for SharePoint is in an invalid state and cannot be uninstalled.
  Install app for SharePoint:
  Uploading the app for SharePoint…
Error occurred in deployment step ‘Install app for SharePoint’: An instance of this App already exists at the specified location.
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========

 

I noticed that my Windows Services were down including the SharePoint Timer Service and I tried starting them all with no joy…

image

…so I actually just restarted the whole environment and when Windows came back up and I went to the SharePoint Site…the App was gone ;-)

Opening up Visual Studio 2013 again and F5’ing got me back up and running ok.

4 thoughts on “Resolving: ‘the app for SharePoint is in an invalid state and cannot be uninstalled’”

    1. patience…it eventually sorts itself out, but typically I just blast the site collection and create a new one. TIP: never deploy apps to production using Visual Studio.

  1. I was getting the same problem in O365. I had already manually removed the app from the “Apps in Testing” as part of my normal anal process before getting the error. After getting the error I poked around and noticed app permission in the SIte Collection App Permissions page (/_layouts/15/appprincipals.aspx), so I manually deleted the permission from there. That didn’t fix it, though. What did fix it (or maybe it was just timing) was going to the App Packages library and deleting it from there.

Leave a Reply