Forum Discussion

John Wildes's avatar
John Wildes
Brass Contributor
Jul 13, 2020
Solved

INI settings in App Directory issue

Hi all I am trying to MSIX package an application that uses an INI file stored in the Application Directory itself to coordinate connections to an SQL server.  Is there a way that I can tell my MSIX...
  • TIMOTHY_MANGAN's avatar
    TIMOTHY_MANGAN
    Jul 14, 2020

    John Wildes 

     

    So if I assume that changing the code of the app isn't an option and that you are repackaging, I would look at one of two methods:

    1.  Use the Application Compatibility Toolkit from the Microsoft ADK to create a custom file redirection fixup.  This is done prior to the packaging.  You identify the exe and create a compatibility shim with a file redirection rule for that one file pointing to the external location. The output of this will be a ".sdb" file.  Then just package the app as normal. You will have to cause the sdb file to be coped to target systems and installed using the "sdbinst.exe" OS utility. Since this must be performed before the user starts the application, MSIX package scripting is not an option to do the sdbinst (which needs elevation anyway). So you'd be using an external method to copy the sbd and ini files and running the command.
    2. Repackage the app using the Package Support Framework and include the FileRedirectionFixup.  This will cause an automatic read redirection to the %AppDataLocal%/Packages folder for the package.  If packaging using the Microsoft MSIX Packaging Tool you can use PsfTooling to add and configure the PSF into the package.  Just ask for the FileRedirectionFixup and keep the default settings.  You can then use your external method to deploy the file to the place the app under the redirected location.  The exact path under the "Packages" folder will depend on how you package. Since you are now using the PSF, you can also add start of application script to perform the ini file copy for you.  The PsfScripting has a pseudo-variable %MSIXWritablePackageRoot% which can be helpful.

    Neither method is simple to provide detailed instructions, but the above outlines the basic techniques.

Resources