Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Cannot run UWP application because VS cannot uninstall the previous version #12908

Open
vsfeedback opened this issue Nov 19, 2020 · 4 comments
Open
Labels
external-vs p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version]
When I press F5 in my UWP application (Xamarin.Forms), it does not start anymore. Visual Studio shows confirmation that it must uninstall the previous version. When I confirm this, the uninstall fails. The app worked well before. I have updated Visual Studio and Windows recently. The deployment output is:

Starting local deployment...
Deploy: START
DeployAsync: START
Reading package recipe file "D:\dotNET\MorseCode\morsecode\MorseCode\MorseCode.UWP\bin\x86\Debug\MorseCode.UWP.build.appxrecipe"...
Shutting down application: "54531PavelHoleek.Morseovka_3.1.1.0_x86__gqfq93fyyk18g"
Deployment layout folder location: "D:\dotNET\MorseCode\morsecode\MorseCode\MorseCode.UWP\bin\x86\Debug\AppX"
Unregistering application "54531PavelHoleek.Morseovka_3.1.1.0_x86__gqfq93fyyk18g" currently installed at "D:\dotNET\MorseCode\morsecode\MorseCode\MorseCode.UWP\bin\x86\Release\AppX" not by Visual Studio deployment.
DEP4010: Deployment canceled by user.
	DeploymentSucceeded = False
	DeploymentError = Err_Deploy_CanceledByUser
	DeploymentHRESULT = 2147500037
	HasSharedCode = False
	Target.Id = 512
	ProjectGuid = {3f7c022d-4c0f-4a1f-abaa-9a3c35dbe92a}
	Project.TargetPlatformVersion = 10.0.18362.0
	Project.TargetPlatformMinVersion = 10.0.18362.0
Deleting file "vs.appxrecipe" from layout...
DeployAsync: END (Failure, 0:00:03,697)
Deploy: END (Failure, 0:00:03,712)

I tried to uninstall the application manually in Windows but it fails with error code 0x80073cfa.
I have also tried to uninstall the application from PowerShell and it also failed with the following error:

remove-appxpackage : Deployment failed with HRESULT: 0x80073CFA, Odebrání se nezdařilo. Obraťte se na dodavatele softwa
ru. (Výjimka na základě hodnoty HRESULT: 0x80073CFA)
error 0x0: Reading manifest from location: AppxManifest.xml failed with error: Operace byla dokončena úspěšně.
.
NOTE: For additional information, look for [ActivityId] 3858d239-bab0-0000-672c-5938b0bad601 in the Event Log or use th
e command line Get-AppPackageLog -ActivityID 3858d239-bab0-0000-672c-5938b0bad601
At line:1 char:1
+ remove-appxpackage 54531PavelHoleek.Morseovka_3.1.1.0_x86__gqfq93fyyk ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (54531PavelHolee...__gqfq93fyyk18g:String) [Remove-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.RemoveAppxPackageCommand

A funny thing is that the error "Operace byla dokončena úspěšně" means ""Operation completed successfully". I have tried to delete all bin and obj folders, clean solution, restore nugets, rebuild the solution. Nothing helps.


Original Comments

Feedback Bot on 11/16/2020, 10:18 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

pavel.holecek on 11/16/2020, 07:32 PM:

Update: I have tried following:

  • Tried to use -allusers parameter when removing app in powershell. No change.
  • I have found article the following article which suggests that the reason could be that Windows accidentally deleted some required XML file for this app in C:\ProgramData\Microsoft\Windows\AppRepository. Without it file, the uninstallation fails. I have looked into the directory and found out that there is now really no xml file for this! The blog suggest creating the XML file manually but this cannot be done because I can't write into this directory even when running PowerShell as administrator.
  • As the last resort, I downgraded Windows from 2004 to 1909 version. This fixed the problem with uninstalling the application. Now I can even run it in the Visual Studio in debug mode. But running it in the release mode does not work. There is an error "Unable to activate Windows Store app XYZ. The activation request failed with error: Application was not launched" (translation from Czech). The error message is not helpful at all. Event log in "Application and Services Log\Microsoft\Windows\Apps" shows basically the same error with additional comment "Activation stage: COM ActivateExtension.". Moreover event log in the Applications section shows an error in my application in module C:\Windows\System32\KERNELBASE.dll (exception code: 0xe0434352).

I still cannot run the application in the release mode or publish new release :-(. I have tried usual clean, rebuild, etc. Nothing helps :-(. This bug is really frustrating.


Original Solutions

(no solutions)

@samhouts samhouts added this to New in Triage Nov 19, 2020
@jsuarezruiz jsuarezruiz added p/UWP s/unverified New report that has yet to be verified t/bug 🐛 labels Nov 19, 2020
@holecekp
Copy link

holecekp commented Nov 19, 2020

I have reported this bug to Visual Studio issue tracker (https://developercommunity.visualstudio.com/content/problem/1256227/cannot-run-uwp-application-because-vs-cannot-unins.html). I think that this is NOT a Xamarin.Forms issue. I have tried different versions of XF that worked well in the past and there were no change.

I believe that the problem was caused either by Visual Studio update, or Windows update. One of them deleted XML file for my application in C:\ProgramData\Microsoft\Windows\AppRepository. Without this file, Windows refuse to uninstall the application so I cannot deploy its new version in VS.

Similar error messages when uninstalling UWP app are mentioned on various sites. Some of them (such as https://www.jriach.co.uk/repair-windows-10-apps/) recommend creating the XML file in C:\ProgramData\Microsoft\Windows\AppRepository manually. However, I cannot write into this folder ieven when I run PowerShell as administrator so, as a last resort, I reinstalled the whole Windows system. Now everything seems to work again.

A few things happened just before the problem appeared: I have downgraded from XF 5.0.0. pre-3 to the latest stable XF 4.8, Visual Studio upgraded to 16.8 and Windows Update installed a major release (1909, but I am not 100% sure). One of them caused the bug.

@hartez hartez moved this from New to External in Triage Nov 23, 2020
@SymboLinker
Copy link

SymboLinker commented Nov 23, 2020

Running an app in Release mode is not a necessity for publishing succesfully to the Windows Store. After you've tested a Debug compilation, you might just want to upload it [EDIT: the Release compilation, created via right-click on the UWP project > Publish > Create App Packages...] to the Microsoft Store (by which I mean https://partner.microsoft.com/en-us/dashboard) and test it from there (via a "Package flight", so that is not yet available for everyone).

@holecekp
Copy link

holecekp commented Nov 23, 2020

@SymboLinker I am using package flights regularly to test each new version before releasing it to the public. I did not know that I could also publish a debug version. I have always used release versions. Unfortunately, this does not solve my problem because this application has already been published a few months ago and a few hundred people downloaded it so I should be able to create also release build not only the debug one.

I was surprised that everything worked well for months and suddenly, after some update, I was not able to run release version of my app on my computer any more because VS could not uninstall the previous version of this app.

I used a drastic solution - I reinstalled everything (Windows, Visual Studio, etc.). Now everything works again. So it is solved for me but I still think that Windows and Visual Studio teams should investigate how this could happen. Reinstalling Windows is not very comfortable solution.

@SymboLinker
Copy link

SymboLinker commented Nov 24, 2020

I did not know that I could also publish a debug version.

I am sorry, I was not clear with "After you've tested a Debug compilation, you might just want to upload it to (...)". What I meant to say was, that after testing a debug compilation, you might just want to upload the Release compilation, even if you cannot start it locally.

Also, side-by-side installations may be possible by modifying the Identity section inside of the Package.appxmanifest file:

  <Identity
    Name="Test.Test"
    Publisher="CN=1A662709-312D-4BC5-93E4-E4203BE6390B"
    Version="1.2.32.0" />

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external-vs p/UWP s/unverified New report that has yet to be verified t/bug 🐛
Projects
Triage
  
External
Development

No branches or pull requests

5 participants