MicrosoftDocs / msix-docs

repository for msix content
Creative Commons Attribution 4.0 International
59 stars 114 forks source link

The update is applied immediately after AddPackageAsync. #301

Closed HppZ closed 2 years ago

HppZ commented 2 years ago

from doc:

The update will be applied the next time your app is shut down.

await packagemanager.AddPackageAsync(new Uri("https://trial3.azurewebsites.net/HRApp/HRApp.msix"), null, AddPackageOptions.ForceApplicationShutdown

same for UpdatePackageAsync.

but according to my test, the update is applied immediately after AddPackageAsync, and the app is killed by Windows. why?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

HarshadaKshirsagar commented 2 years ago

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

HppZ commented 2 years ago

and what is the difference between AddPackage* and UpdatePackage*

HarshadaKshirsagar commented 2 years ago

Either can be used for updating, we recommend you use AddPackage for install and update both. It simplifies code.

HppZ commented 2 years ago

thanks