Forum Discussion
martijnk79
Nov 02, 2023Brass Contributor
File redirection question
Hi, This file redirection feature is very confusing to me. I have an application that writes to the temp folder (in localappdata) and the roaming appdata folder. Right now these files are stored i...
Nov 02, 2023
Answers for three scenarios:
1) First of all, if you don't have any VFS\AppData files inside the package, you don't need to redirect that folder, and you would get the effect of those write attempts going to the original location. To achieve this, add the "isExclusion" entry to the entry for AppData.
2) If the app needs visibility to VFS\AppData files from the package but you want the app to be able to update/add to them but have the updated/new files under the user's AppData folder this can be achieved.
2A) The FileRedirectionFixup has a feature (not added to the MfrFixup I just realized) that allows you to add an entry in a PackageRelative entry of the FileRedirectionFixup. It is called "redirectTargetBase". RetargetBase is an override to indicate that the entry should not redirect to the package redirection area, but to this specific location.
But certain locations, especially AppData (as in the user's AppData/Remote folder) are subject to being redirected by the container at a level lower than the PSF and we can't control that from happening. But is you specify the value of "redirectTargetBase" to a path that looks like something else you can. For example, let's say that your system uses FolderRedirection to map the AppData/Roaming to a home drive already. Then if you specify the value of the home drive folder, the redirection will go there and the container will not interfere.
2B) The third alternative is for situation where another product is being used for general user redirections, such as FsLogix, Microsoft UEV, and Ivanti for example. These products also redirect at a level lower than the PSF, and in this case customers generally let the PSF redirect to the WritableRootFolder and then add a rule in those products to redirect the WritableRootFolder to wherever they store things.
See:
MSIX-PackageSupportFramework/fixups/FileRedirectionFixup at develop · TimMangan/MSIX-PackageSupportFramework (github.com) scroll down for specific information on the json entry for the PackageRelative entries.
Also the general Wiki page for the FileRedirectionFixup:
Fixup: FileRedirectionFixup · TimMangan/MSIX-PackageSupportFramework Wiki (github.com)
martijnk79
Nov 03, 2023Brass Contributor
Thanks for the extensive answer! Option 1 would be sufficient for us, but somehow it's not working. By adding the 'isExclusion' entry I assume you mean in the packager I go to files ,right-click the directory and choose 'Add Exclusion' is what I did. Am I correct?
I also tried to add '[{AppData}]' to the global exclusion list but files still appear under AppData\Local\Packages\<PackageName>\LocalCache\Roaming.
Which is weird, because the TEMP directory is excluded as well and those do show up outside of the package.
I also tried to add '[{AppData}]' to the global exclusion list but files still appear under AppData\Local\Packages\<PackageName>\LocalCache\Roaming.
Which is weird, because the TEMP directory is excluded as well and those do show up outside of the package.