stevemaughan
Posts: 4
Joined: Wed Jul 08, 2020 2:30 pm

APPX & %programdata%...

Wed Sep 16, 2020 3:34 pm

Hi,

I'm trying to create an APPX installation, with the ultimate aim of getting my application onto the Microsoft Store.I'm new to this and having problems.

My application stores data in a folder located in "%programdata%\Cozmix\AlignMix", that is normally located at "c:\ProgramData\Cozmix\AlignMix". I assumed that when a program is packaged as an APPX application it would virtualize this path, but that doesn't seem to be happening. My application still seems to wanting to access the "c:\programdata" folder and gives an AV when it's unable to proceed.

Note: I'm getting the folder path using the following Delphi routine (and CommonAppDir is True):

Code: Select all

function LocalAppDataPath(const CommonAppDir: boolean): string;
begin
  if CommonAppDir then
    result := IncludeTrailingBackslash(TPath.GetPublicPath)
  else
    result := IncludeTrailingBackslash(TPath.GetHomePath)
end;
My questions are:

1. Can application packaged as APPX applications store and access data in the %ProgramData%

2. Should I transfer to using AppData or LocalAppData?

3. Am I missing something obvious?

Thanks,

Steve

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

Re: APPX & %programdata%...

Tue Sep 22, 2020 7:02 pm

Hello Steve,

Please note that the %programdata% is a per-machine location.

MSIX, unlike a classic MSI, is installable per user and not per machine, even if the files are saved in %Programfiles%\WindowsApps.

If we have a look over the Microsoft's "ProgramData" article, we can notice that:
Warning:

We don’t recommend using this setting, except perhaps in a test environment. The following are known issues:

Microsoft Store apps are not supported.
This is enough to answer your first question.

In what regards your second question:
2. Should I transfer to using AppData or LocalAppData?
The answer is yes.

As this might be a little bit tricky, I suggest having a look over the "How does Files Redirection works with MSIX?" article, in which my colleague Alexandru explains it.

Hope that will help!

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

Return to “Common Problems”