siebrasse
Posts: 5
Joined: Wed Oct 27, 2021 6:15 am

Using variables in Folder Redirection

Wed Oct 27, 2021 9:16 am

I want to redirect a text file from AppDir to the users Appdata folder.



In advanced installer I have setup:

Folder: APPDIR

File Name Pattern: .\.*txt

Destination: c:\users\<myusername>\Appdata\Roaming\<vendor>



Then the MSIX works fine for me but not for 15.000 other users. So I would like to use a variable in Destination. So far I have tried and failed:

%appdata%\<vendor>

[AppDataFolder]\<vendor>
AppDataFolder\<vendor>
%AppDataFolder%\<vendor>
[%AppDataFolder%]\<vendor>
[AppDataFolder%]\<vendor>
[APPDATAFOLDER]\<vendor>

[APPDATAFOLDER]<vendor>

[AppDataFolder]<vendor>

[AppDataFolder]'\<vendor>'
[AppDataFolder]+'\<vendor>'
[AppDataFolder]&\<vendor>



Can anyone tell me what the convention is to get a variable in the Destination path name?

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

Re: Using variables in Folder Redirection

Thu Oct 28, 2021 4:30 pm

Hello Edwin and welcome to our forums,

Unfortunately, it is not quite clear to me what operation you are using to try and copy the file.

If possible, could you please forward me a step-by-step test case which I can follow in order to investigate this on our end?

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

siebrasse
Posts: 5
Joined: Wed Oct 27, 2021 6:15 am

Re: Using variables in Folder Redirection

Fri Oct 29, 2021 8:10 am

This question is answered by Tim Mangan at the following post
https://techcommunity.microsoft.com/t5/ ... 1324#M1327.

If you want to see this in action your self you can do the following:

prerequist is that you have a .txt file in APPDIR

Steps:
1) open AppCompat
2) create a new File Redirection
3) Select in Folder APPDIR
4) type in file name pattern: .*\.txt
5) type in destination C:\Users\<username>\AppData\Roaming\<vendor>

Now Install and Run the MSIX. It will work.
Now try to use a variable instead of C:\users\<username>\AppData\Roaming. As you can read in the reply of Tim Mangan PSF can not solve this issue. I assume that would mean that Microsoft has to solve it in the PFLauncher.

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

Re: Using variables in Folder Redirection

Fri Oct 29, 2021 4:10 pm

Hello Edwin,

Thank you for the followup on this and for providing the steps.

I tested this now and I indeed managed to reproduce the scenario.

The reason why the "Destination" field does not support a property is the fact that the field is used by a DLL at the application's runtime (when the executable installed by your MSIX is run). At that point, there is no way for that DLL to know the value of the [AppDataFolder] property.

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

Return to “Common Problems”