sjt62349
Posts: 1
Joined: Fri Mar 26, 2021 6:02 pm

Read from current directory in MSIX Store environment.

Fri Mar 26, 2021 6:18 pm

I am using the Visual Studio Application to create a MSIX for the MS Store. I am reading a Rich Text File which I put in Files and Folders next to the program executable. When I build an MSI, it works fine. But with MSIX, I get a File Not Found. When I send the MSIX to the MS store it does get certified OK, but I still get File Not Found. I know there is some kind of virtual file structure thing with MSIX, but I just do not know what to do to resolve this. thx ---sjt

Catalin
Posts: 4086
Joined: Wed Jun 13, 2018 7:49 am

Re: Read from current directory in MSIX Store environment.

Tue Mar 30, 2021 4:55 pm

Hello Sjt and welcome to our forums,

By default, an MSIX is installed/extracted in the %ProgramFiles%\WindowsApps folder.

This is a system location, inaccessible, by default, from Windows Explorer. Only the OS can write in this location when installing your app.

If your application needs to read from a file, it is recommended to write that file in the %appdata% folder, so your application can have access to it.

For more infromation about this, please have a look over our "Install Location" article.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

timmangan
Posts: 32
Joined: Fri Mar 30, 2018 1:17 pm

Re: Read from current directory in MSIX Store environment.

Fri Apr 02, 2021 2:08 pm

The working directory of a MSIX app (without PSF help) is actually the System32 folder, not the executable folder like it usually would have been with an MSI installer.

Since you have source access, you can change the working directory in your program at initialization. In dot net you can look at the executingassembly. For unmanaged programs, adding the installation folder into the registry of your package is probably easier to get at.

Catalin
Posts: 4086
Joined: Wed Jun 13, 2018 7:49 am

Re: Read from current directory in MSIX Store environment.

Tue Apr 06, 2021 12:12 pm

Hello Tim,

Thank you for sharing that information with us.

I was not aware of this behavior.

Hopefully this will be of help for the above user and for other users facing a similar scenario.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”