A key phase in installing a package is staging the package:
var packageUri = new Uri("C:\\Packages\\ContosoParts-v1.2.3.4-x64.msix");
var options = new StagePackageOptions();
var packageManager = new PackageManager();
var result = await packageManager.StagePackageByUriAsync(packageUri, options);
When a package is staged for the first time, deployment performs several actions, including:
- Creating a new package directory (commonly referred to as the pkgdir), for example
C:\Program Files\WindowsApps\Contoso.Parts_1.2.3.4_x64__1234567890abc - Extracting the contents of the .msix into the pkgdir
- Applying a tightly restricted access control list (ACL) to the pkgdir
- Creating related directories used for system bookkeeping associated with the package
- Applying similarly restrictive ACLs to these bookkeeping directories
Deployment secures these directories with strict permissions, typically granting users Read and potentially Execute access – but notably not Write access.
This ensures one user cannot modify the contents of a package in a manner that would compromise their own environment – or anyone else’s.
Because MSIX guarantees the immutability of the pkgdir after staging, it can be safely shared across all users on the system – regardless of who installed the package or how many users make use of it.
This immutability also allows MSIX to efficiently minimize on-disk storage for identical content shared across packages.
But more on that in Part 2…
0 comments
Be the first to start the discussion.