Create a directory in any location based on packaged app directory

In order to satisfy certain requirements, apps may require the files to appear in their existing install directory. For example, if a particular app was expecting a file in a folder, like C:\Program Files\Contoso; that directory can be modified by the admins. Starting in Windows 11, apps can specify a directory outside of the WindowsApps directory and the OS will ensure that files will appear in that location with proper ACLs inherited from the parent directory.

Declaring the location of the directory in the manifest

To enable this feature, the package will need to declare where to project the files in the package to. Below is an example

    <desktop8:Extension Category="windows.MutablePackageDirectories"> 
        <desktop8:MutablePackageDirectory target="$(package.volumeroot)\Program Files\<Folder>" Shared=”true”> 

Considerations for projection

Before using this feature, here are a list of considerations:

Considerations Description
How to install a package with the ability to project? Packages have to install through ProvisionPackageForAllUsers API
Who can install it (users or admins)? Admin
Where can the files be projected to (locked location, or anywhere at all)? Anywhere besides %pf%\windowsapps or %pf%\modifiablewindowsapps
What are the ACLs on the projected directory if we create it? Inherited from parent directory
Can more than one package declare the same directory? We do not allow more than one related set to declare the same directory. In other words, if there are multiple packages declaring the same directory, they must all be from the same related set.
What about more than one publisher? No
How are collisions handled? Packages and/or pre-existing files are merged. Conflicting files are resolved in specified priority order, or package-name alphabetically, if no order specified