How do I uninstall a Staged App Package on my Surface RT?

5

Windows 8 downloads updated packages of installed apps so that updating to the newest package is a much smoother process. Unfortunately, if you uninstall an app, it does not always remove these 'Staged' app packages.

On top of this, you cannot access them, as they were installed by another user. You can't even call "Remove-AppxPackage" from Powershell to remove them.

The reason this is an issue is that I have a Surface RT that I am using to develop my Windows Store App. If there is an "unpackaged" application already installed on the system, Visual Studio is unable to overwrite it unless it's installed only on the user currently running. This unfortunately means that if I am also testing receiving the app from the store and there are staged packages of my own app, then I am unable to deploy my app to my Surface. I get error

Error : DEP0700 : Registration of the app failed. Another user has already 
installed a packaged version of this app. An unpackaged version cannot 
replace this. The conflicting package is [MyProjectName] and it was 
published by [MyCertificate]. (0x80073cf9)

How can I remove these Staged Packages from my Windows RT Device?

windows
powershell
windows-8
windows-runtime
windows-store-apps
asked on Stack Overflow Jul 24, 2013 by Nate Diamond • edited Jul 24, 2013 by Nate Diamond

4 Answers

6

As outlined in this previously asked question, there are a few ways to do it. The key is that you must run the Remove-AppxPackage Powershell cmdlet as the System. Sysinternals has a tool that allows you to do this, psexec. Unfortunately, it is not compiled for ARM and cannot run on the Surface RT (or any ARM device). On top of this, running the command as the System account is also quite hard in itself.

Luckily for us, there is a way of doing this without too much hassle (unless you don't have this guide, then prepare for a world of hassle ;). We are going to 0) Make sure it is indeed Staged app packages causing our deployment failure. 1) Schedule a Task. 2) Set it to use the System account. 3) Set the Action to the proper command. 4) Make sure the Task is able to run on demand. 5) Run the task. 6) Check and see that the app package is no longer installed.

You are going to need Administrator access on the Windows RT device in question.

0) Make sure the staged apps are indeed causing the failure.

  • Run Powershell as Administrator. To do this, either right click the the executable or swipe up on the Start Screen tile and tap Run as Administrator.

  • Run the command "Get-AppxPackage -all". This will take a second, then display all installed app packages for all users.

  • What you are looking for is an app package with the name of your app. Something like "XXXXXXX.MyApp". Look for the InstallState to be Staged, near the bottom of the description. The User will also be Unknown.

  • If there are no versions of your app currently installed, this is not your issue.

1) Schedule a task.

  • On the Start Screen, open "Schedule tasks". You can also get to it through the Administrative Tools, I believe. You should also make sure the Task Scheduler service is currently running.

  • On the right hand side, click/tap "Create Task..."

  • Give a quick name for the task, such as "Remove staged packages"

2) Set it to use the System account

  • Just below the middle of the General tab, at the top of Security options, click the button that says Change User or Group.... This will bring up a dialog for you to set the context of the Task.

  • Type in "System", then click "Check Names". SYSTEM should be underlined and all in caps.

  • Click OK. The user account should now say NT AUTHORITY\SYSTEM.

3) Set the Action to the proper command.

  • Go to the Actions tab at the top. Click "New".

  • The default Action should be Start a program. This is correct.

  • Click the Browse... button and navigate to C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.

  • In the Add Arguments (optional): field, type: -c "get-appxpackage | remove-appxpackage", including all quotes. The | character is the "pipe" character. Is should be SHFT+\ (Shift and backslash, just above Enter).

  • Click OK

4) Make sure the Task is able to run on demand.

  • In the Conditions tab, uncheck Start the task only if the computer is on AC power. This is not really necessary, but less of an annoyance.

  • In the Settings tab, make sure that Allow task to be run on demand is checked. It should be by default, but it's good to make sure.

  • Click OK at the bottom.

5) Run the task.

  • In the left pane, click the Task Scheduler Library. This will update the center pane to include our new task.

  • Make sure that the Status is Ready. It should never have been run before.

  • Click the task in the list. In the right-hand Actions pane under Selected Item, click Run.

  • If you want to see it in action, click the Display All Running Tasks. You will be able to see when it is currently running. You can click refresh repeatedly. When the task disappears, it is done.

  • Click Refresh in the Task Scheduler Library section in the right pane. The task should have have a Last Run Time of very recently, and the Last Run Result should be The operation completed successfully. (0x0).

6) Check and see that the app package is no longer installed.

  • Basically, repeat step 0). Run Powershell as Administrator. Run the command Get-AppxPackage -all. Check and see if the Staged packages are still installed. They should not be.

You are now done! You should be able to deploy your app package to your Windows RT device.

answered on Stack Overflow Jul 24, 2013 by Nate Diamond • edited May 23, 2017 by Community
2

You have to remove the provisioned package to clear the staged package. Use the following command from an elevated PowerShell prompt (don't forget to replace the string with your app display name):

Get-AppxProvisionedPackage -Online | Where-Object DisplayName -eq 'App Name Here' | Remove-ProvisionedAppxPackage -Online

answered on Stack Overflow Feb 1, 2018 by Jason Willett
1

A more risky way of removing it is to go into the registry and remove the keys that pertain to the app you want to remove. I can confirm that this way does work (restarted after the deletion and did a "get-appxpackage -all" and it was gone).

answered on Stack Overflow Sep 27, 2013 by Derick Wiebe
1

This worked for me when Sysprep failed. Luckily it was in a VM (Checkpoints).

I also ran [get-appxpackage | remove-appxpackage] from PowerShell itself after running the above task.

Thank you.

Keywords:

Microsoft.Media.PlayReadyclient Microsoft.VCLibs.

answered on Stack Overflow Jul 21, 2016 by Cole

User contributions licensed under CC BY-SA 3.0