Automatically uninstall and then reinstall Windows 8.1 App package while start debugging

By | September 7, 2014

When you start debugging by using F5, Visual Studio builds and deploys the app in a respective packages in the local storage, and then starts the app. If you stop  the debugging, you can run the app from installed location or if you execute it from Visual Studio again, Visual Studio just update the packages with updated components ( if there is any) and run it again.  While this is a common and regular process, there are some cases where, before you start debugging,  you may want to uninstall the app first, clear you local storage data.

To uninstall and clear the app local storage, we generally do it manually by uninstalling the app.  However, this can be automatically taken care by Visual Studio by applying few settings.

  1. Open the Project Properties Windows
  2. Navigate to “Debug” Tab
  3. and then select “Uninstall and then re-install my package. All Information about the application state is deleted
  4. Save the settings.

 

image

When this option is selected, Visual Studio first uninstall the app packages and then reinstall it before start.  This procedure is useful when you need to debug an app that was already  installed and that uses local states , storage information and you wanted to clear them before start the debugging.

Hope this was useful.

Thanks,

Aj