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
You probably mean this right? For some reason when I add the file redirection fixup, the app won't launch any longer. With procmon I see an invalid parameter error.
- Nov 03, 2023
No. In option 1 you are not including the FileRedirectionFixup at all. If you need the fixup, you are looking at option 2.
In Option 2, you need to edit the config.json to be more like this:
"redirectedPaths": {
"knownFolders": [
{
"id": "AppData",
"relativePaths": [
{
"base": "C:",
"patterns": [
".\\"
]
},
"IsException": "true"
]
},...
But in all honesty I don't use the new built-in PSF that the Packaging Tool now has; it is over 2 years out of date with changes. So I can't swear that will work with that version of the PSF. Instead, I would use PsfTooling, which has an up-to-date PSF, while in monitoring mode of the Packaging Tool (right after you installed the app) to add and configure the PSF.
- martijnk79Nov 14, 2023Brass Contributor
TIMOTHY_MANGAN I tried to use psftoolsd but when launching the app the entire system is crashing wow!
- Nov 14, 2023Please send the version of PsfTooling that you were using and any relevant information. There was an application crash issue on the debug build fixed in the last release. Feel free to reach out directly at email address removed for privacy reasons