Forum Discussion
Nothi1717
Jan 19, 2022Copper Contributor
Update a non store App deployed via MSIX using the PackageManager API, no ForceShurdown
I managed to create a MSIX Package for my WPF Desktop App and successfully included the Windows.Management.Deployment dependency. My goal is to get some kind of auto update going by calling: va...
Nothi1717
Mar 09, 2022Copper Contributor
Any Ideas? Is it even possible to do this? Any alternative approaches?
- harshada2019Mar 10, 2022MicrosoftI think you could use DeferRegistrationWhenPackagesAreInUse. It is a Boolean value, TRUE indicates that registration of the main package or dependency packages will be delayed until the next time the application is activated if the packages are currently in use; otherwise, FALSE.
We will update the doc to reflect this.
References:
AddPackageOptions Class
https://docs.microsoft.com/en-us/uwp/api/windows.management.deployment.addpackageoptions?view=winrt-22000
AddPackageOptions.DeferRegistrationWhenPackagesAreInUse Property
https://docs.microsoft.com/en-us/uwp/api/windows.management.deployment.addpackageoptions.deferregistrationwhenpackagesareinuse?view=winrt-22000#windows-management-deployment-addpackageoptions-deferregistrationwhenpackagesareinuse- Nothi1717Mar 11, 2022Copper Contributor
Hello Harshada,
many thanks for your reply, I already tried to implement your proposal:
var res = await pm.AddPackageByUriAsync(uri, new AddPackageOptions() { DeferRegistrationWhenPackagesAreInUse = true});
Unfortunately this will throw an exception: Object reference not set to an instance of an object.
In the background though, something is actually happening because catching this exception and restarting the app will apply the update.
Do I miss some more input?
Another thing that puzzles me is that the docs say:
"The URI of the package to add. The URI must follow the file URI scheme (file://) since the only supported URI schemes are local file paths and local network paths."Well, I am using a URL pointing to a Azure Blob. Is this even possible?
- Nothi1717May 23, 2022Copper ContributorAny more thought on this?