Closed Mathyn closed 1 year ago
We are looking into this issue. @prkhandelwal-msft
Seems like an app specific issue, I converted an app(different from the one mentioned in the post) that requires windows service using latest version of MSIX Packaging Tool and tried to reinstall MSIX and I was able to find the service that is packaged among all the windows service.
Hi, thanks for your reply. I'll run some more tests and see if I can produce a minimal example proving/disproving this issue.
@prkhandelwal-msft just to clarify about the reproduction steps. If I simply reinstall the app things work fine. What causes issues for me though are these steps:
After following these steps it fails to reinstall the service.
Can you verify the app you used for testing also works in this scenario?
@Mathyn I followed the same steps mentioned, the app I used was LogmeIn Hamachi, it creates a service called hamachi-2 upon installing. On uninstalling via Windows Apps and Features in settings the service got removed from the list and on reinstalling i was successfully able to install the app again and the service was again visible in the list.
@prkhandelwal-msft clear, thank you for double checking. I'll work on a minimal example next week and I'll update this post with my findings.
Hi, I've created a minimal example which you can find here https://github.com/Mathyn/TestMauiAppWithService
You may need to add your own local signing certificate before publishing. I've tried to stay as close as possible to the templates provided by Microsoft.
I've used the following templates:
.NET MAUI Blazor App
(with .NET Core 7) for the appWindows Service (.NET Framework)
(with .NET Framework 4.8) for the serviceTo reproduce:
dotnet publish -f net7.0-windows10.0.19041.0 -c Release /p:RuntimeIdentifierOverride=win10-x64 .\TestMauiApp\
)This time however I got an error while installing. I've seen this happen a couple of times with the original app as well but after some time these disappeared again (and instead I get the error where a service was not installed).
When installing the second time I get the following error:
App installation failed with error message: AppX Deployment operation failed with error 0x0 from API Logging data because access was denied for file: \\?\C:\Program Files\WindowsApps\C1964CB7-9D0F-4355-9225-4A4ADDE15BC1_0.0.1.0_x64__43bca71cbdt9w\AppxManifest.xml, user SID: S-1-5-18 (0x80070005)
Navigating to the folder in WindowsApps
shows several files still remaining. I can manually delete this except for one: AppxManifest.xml
. The only way to get this file off my system is rebooting my PC, after rebooting I can reinstall the test app again. I can redo these steps as often as I want and produce the same result.
Trying to install the app via Powershell as administrator using Add-AppxPackage
also yields the same result.
Did some further testing on a clean Windows 10 installation (using a virtual machine hosted with Hyper-V) and found that the installation folder does get properly removed there and installing and uninstalling works just fine. On this clean machine the service also gets installed properly so I'd say it should work but for some reason on some Windows PCs it just doesn't.
Checking back with the original app I can see it also does not remove the installation folder on uninstall. This may be on purpose but I'm wondering if this could explain something?
Please let me know if I can provide any more information to debug this. On my side my client is committed to solving this and will allocate time if needed.
Hey, I build your project and published it to MSIX using the dot net publish command (I also tried publishing it via visual studio 2022 but it failed showing this error MSB4057 The target "_GenerateAppxPackage" does not exist in the project.
but running your command worked and I got the output MSIX.
I followed the following steps then -
I tested it again just to verify once more but the issue is not reproducible at my end. Also can you check before first time installing the MSIX, is the service already present in the system because if an unpackaged version of service is present in the system then adding the same service through MSIX fails. Although the error message that I know is different as compared to this but can you still verify?
Hi, thank you for taking the time to verify this!
Quick note about the issues you did encounter:
_GenerateAppxPackage
target I got as well. Seems we are not the only ones: https://github.com/dotnet/maui/issues/12625I've checked to see if a service was already present before installation. This was not the case though.
I did find a potential cause last week. We recently finished work on upgrading the project from .NET 6 to .NET 7 (and from WindowsAppRunTime 1.1 to 1.2 as a consequence). We found we could no longer reproduce the issue on our Windows 11 test system after the upgrade. I also verified I could no longer reproduce it on a clean Windows 10 VM. Locally however on my system (Windows 10) issues remain.
I uninstalled all instances of the WindowsAppRunTime on my machine and reinstalled 1.2 again but this did not work.
With this latest information I am unsure how to proceed with this ticket. It could be related to using the old 1.1 runtime. The issues still remaining on my system I can't explain but it might be a very specific local issue.
@prkhandelwal-msft what do you think? Do you have any ideas to further debug this? Otherwise we can also consider closing this for now.
Hey @Mathyn, just to add, today i tried reproducing the same in windows 10 hyper-v clean environment. There too upon uninstalling the service was getting removed as well, but in win10 this test app was not launching. My guess would be there must be something in your local system that is inhibiting the service to not get uninstalled because this kind of behavior is not generally seen with MSIX. What I can think of is that as this service that you created in the TestMauiApp runs as a local system, your user account may not be able to uninstall it. You can test uninstalling any service that runs as a local system manually and verify it.
Can you try to do one more thing at your end, -
Also I think you can close this issue as well for now.
Hi, double checked and the service does get uninstalled properly so whatever issue my system seems to have it only pop ups once I reinstall things again.
I'm going to chalk this up to a combination of my system and using an outdated WindowsAppRunTime.
I checked gpedit.msc and the setting is set to 'Not Configured'. Was there anything specific you wanted me to check or configure?
@Mathyn Did you get it to work?
Project MSIX SDK
Describe the bug We have a MAUI app packaged as an MSIX which includes a Windows service. However we are getting bug reports which indicate the service is not running. Research shows that the service is missing for some users.
After some debugging we found that if you uninstall any version of our app and then reinstall it again the service is not created.
Looking through the eventviewer at the logs for the AppXDeployment-Server I see the following warning in the scenario the service is missing:
To Reproduce
No amount of reboots, uninstalls/reinstalls will fix the system for me now. The only way to fix it is to install a different version of the app. Don't know why but either a version downgrade or upgrade seems to register the service again.
Expected behavior Uninstall the app should remove the service, reinstalling the same version should then add the service again.
Platform
Verified on Windows 10 and Windows 11.
Additional context
Our appxmanifest looks like this: