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.

App Deployment Error: "Your app handles the uninstalling app event"

3 thoughts on “App Deployment Error: "Your app handles the uninstalling app event"

  1. Rich Van Rooyen says:

    Hey Andy… Do you know if there are any improvements to this process? I have wasted so much time messing around with remote event receivers, it is just bizarre. I’m simply trying to, for an example, set the title of a list item when I add an item to the list. I have come from developing event receivers in SharePoint 2010 (on premises mostly). This debugging process is full of traps and makes it so complex to do something so simple. I actually wrote one of these back about 2 years ago and it is running in production today without issue.
    I find it amazing that Microsoft hasn’t developed some way to better enable developers to do this type of work… Works fine in the app web, screwed on the host web!
    I’m considering saying screw it and using SharePoint Workflows to do all this work… At least those seem relatively reasonable to debug and write. I could also use a regular Web Service to call from the workflow rather than this bull#$%$…

    There must be an easier way to do this!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.