Forum Discussion
Service Msix Automatic Update
Hi,
We have a service that we deploy using msix, all is working, however we now need to have the service automatic updated wihtout user interaction. We deploy the service outside microsoft store and want it to be like that for now... Ive implemented a small command line utility that i run that will run
[E:\WinUiPackage\TeklaTBone\TeklaTBoneMsix_1.2.43.0_Test] cmd /c powershell -command "Add-AppxPackage -ForceApplicationShutdown -Path E:\WinUiPackage\TeklaTBone\TeklaTBoneMsix_1.2.43.0_Test\TeklaTBoneMsix_1.2.43.0_AnyCPU.msixbundle"
when running this outside the service the utility works fine. However when i run under the service, and under SYSTEM account i get:
Install Msix E:\WinUiPackage\TeklaTBone\TeklaTBoneMsix_1.2.44.0_Test\TeklaTBoneMsix_1.2.44.0_AnyCPU.msixbundle
[C:\WINDOWS\system32] cmd /c powershell -command "Add-AppxPackage -ForceApplicationShutdown -Path E:\WinUiPackage\TeklaTBone\TeklaTBoneMsix_1.2.44.0_Test\TeklaTBoneMsix_1.2.44.0_AnyCPU.msixbundle"
Result: Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF9, Install failed. Please contact your software vendor.
(Exception from HRESULT: 0x80073CF9)
Deployment Add operation rejected on package 66daac85-c649-42b7-b4ee-0deca2697f95_1.2.44.0_neutral_~_63fv57jsaj22j
from: TeklaTBoneMsix_1.2.44.0_AnyCPU.msixbundle install request because the Local System account is not allowed to
perform this operation.
NOTE: For additional information, look for [ActivityId] 2a54b8ab-74ad-000d-8580-552aad74d801 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 2a54b8ab-74ad-000d-8580-552aad74d801
At line:1 char:1
+ Add-AppxPackage -ForceApplicationShutdown -Path E:\WinUiPackage\Tekla ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (E:\WinUiPackage...yCPU.msixbundle:String) [Add-AppxPackage], IOException
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand
Its clear that the security for this account doesnt allow us to install the app. What are the alternatives here?
Ive tryed both runas, and elevate utilities... they both lock the process because they are requisting user interaction. either pass or uac bypass... Since we dont have the admin password this is not a possibility
Is there are any way of doing this wihtout the microsfot store?
Thanks
9 Replies
- Aniket_BanerjeeFormer Employee
Hi jocs,
Can you try this command instead of Add-AppxPackage
Add-AppxProvisionedPackage -Online -PackagePath ".\Test.msix" -SkipLicense
- JDHIntercedeBrass Contributor
Have a look at AppInstaller files (https://docs.microsoft.com/en-us/windows/msix/app-installer/app-installer-file-overview). You can specify automatic update behaviour in the file itself, and when you want to push an update it's just a case of updating the appinstaller file to point to newer version(s) of your MSIX packages and it'll work its magic for you. You can continue to do the initial deployment with Add-AppxPackage (it supports appinstaller files), with subsequent updates managed by changes to the appinstaller file.
- jocsCopper Contributor
JDHIntercede Thanks for the reply, this seems to be a way forward. however im running into problems running my app using the appinstaller....
If i install it from the bundle file, the service runs correctly.
If i install from the appinstaller while having the URI pointing to local folder or azure, the installation happens however it service doesnt run. I get this error:
Exception Info: Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 14: 'unable to open database file'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)This tells me the permissions after installing have somehow changed comparing to previous install method. Everything is installed, however this fails
optionsBuilder.UseSqlite($"Filename={Path.Combine(runningPath, "MyDatabase.db")}");
Also if i unistall the app, installed with appinstaller, then it unistalls but the service is still show in services control panel... Only after restarting the machine it disappears.
Thank you again
- jocsCopper ContributorAlso the suggestion doesnt seem to work, or i am ensure how to test it:
<UpdateSettings>
<OnLaunch HoursBetweenUpdateChecks="24" />
<AutomaticBackgroundTask />
</UpdateSettings>
I have this, and i was expecting that by stoping the service and starting it again it would trigger the upgrade? Or the only real time this kicks in is if we restart the windows machine? Since this is a Windows Service?