App Deployment Error: “Your app handles the uninstalling app event”

When trying to do an F5-Deploy of a Provider hosted app from Visual Studio, I got this error during the deployment:

Error occurred in deployment step ‘Uninstall app for SharePoint': Your app handles the uninstalling app event. Ensure that the Windows Azure Cloud Web Service project is deployed to the emulator prior to uninstalling the app.

This happened just after the step “Uninstall app for SharePoint” in the process.

Googling the error didn’t find a lot of results – in fact, there is only this thread. It recommends:

As a workaround, please try setting your app’s “Handle App Uninstalling” property to “False” before you F5, and then from the app project’s context menu, run the “Retract…” command. This should unblock the retraction of the app during F5, after which you can re-enable handling of the uninstalling events.

Well… I tried that. Turning off the handling of the App Uninstalling event did make the F5 deploy work – but my Uninstalling event was never run (as one would expect). I did run the Retract command, but when I re-enabled the handling of the uninstalling event the problem recurred.

If I enabled the Uninstalling event and did a proper deploy – not an F5 one – then the uninstalling event actually worked nicely. By some miracle my code had no faults, and did exactly what it was supposed to do (remove a Remote Event Receiver definition).

Thus, for now, I’ll just add this to the list of changes that need to be performed between debug and release. I’m not sure how one can debug the uninstalling event, though.

2 thoughts on “App Deployment Error: “Your app handles the uninstalling app event””

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>