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"

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

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s