Forum Discussion
jocs
Jun 01, 2022Copper Contributor
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 ...
JDHIntercede
Jun 27, 2022Brass 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.
- jocsJul 15, 2022Copper 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
- jocsJul 15, 2022Copper 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?- JDHIntercedeJul 15, 2022Brass Contributor
The config you have here means that it will only check for updates on launch once in a 24hr period, and if it has just been installed then I suspect it's not going to look until 24hrs after that (although that's just a guess). Try removing the HoursBetweenUpdateChecks to enforce a check on every launch. It's also worth checking the features you're trying to use are supported on your version of Windows.
All this being said, if the permissions issue you mention earlier is because AppInstaller isn't elevating correctly then you may run into the same issue when it installs an update.
- JDHIntercedeJul 15, 2022Brass ContributorHmm, I've not installed a service with AppInstaller myself but it should be identical to installing from the msixbundle directly. The only thing I can think is that services need admin permissions to install, and perhaps that's not happening when you use the AppInstaller. Does it ask you to elevate when you run it? If not, try running it from Add-AppxPackage in an elevated console and see if that sorts it - if it does, then it sounds like you've found a deficiency in the way AppInstaller handles admin installs.