jtan
Posts: 2
Joined: Wed Jul 01, 2015 9:39 pm

Conditionally copying installed files to APPDIR based on installation language

Using Advanced Installer 11.3, I am building a single exe installer that supports multiple languages. I would like to persist the installation language into a setting that my application will use to perform runtime localization.

My localized application contains a folder for each language, where the satellite assemblies are stored. In the subfolders, I have a configuration file, which has a parameter (amongst others) that specifies the language.

i.e.
[APPDIR]\de
[APPDIR]\en
[APPDIR]\es
[APPDIR]\fr
[APPDIR]\it
[APPDIR]\ja

I would like to copy the configuration file into the root directory at some point in the installation after the language has been selected.

I have tried to perform a File Operation > File Copy/Move based on the installation condition, but that didn't work because the files all contained the same name. The File Copy/Move was also failing to actually copy the file. It's possible that I did not enter the correct parameters in the dialog. Is the Name field (under Source File or Destination File group box) supposed to be a Property? I would have thought that you would allow directly selecting the source file, but there is only a folder selector, and not a file selector. Makes me think I was doing something wrong.

I've also looked into Custom Actions but I couldn't find one that allowed conditionally copying files (post installation).

Help would be appreciated. Thanks in advanced.
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Conditionally copying installed files to APPDIR based on installation language

Hello and welcome to Advanced Installer forums,
I would like to copy the configuration file into the root directory at some point in the installation after the language has been selected.
In order to achieve this you can enable the Install folder content into the parent folder option from the Folder Properties Tab. If this option is enabled, the folder content will be installed into its parent folder. Please use the attached image for your reference:
FolderProperties.png
FolderProperties.png (37.41 KiB) Viewed 4646 times
In order to conditionally install each file, here is what you can do:
  • Select the file that you conditionally want to install
  • Use the F8 or the Go to Component toolbar option
    OBS: After this step you will be redirected to the Organization page
  • Condition the component installation through the Condition field from the Component properties using the ProductLanguage property.
    e.g. in order to install the component when the English language has been selected, you should have something like that:

    Code: Select all

    ProductLanguage = 1033
    
Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jtan
Posts: 2
Joined: Wed Jul 01, 2015 9:39 pm

Re: Conditionally copying installed files to APPDIR based on installation language

Thank you Dan. That worked perfectly. And now I know a new trick to add to my playbook!
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Conditionally copying installed files to APPDIR based on installation language

You're welcome,

If you have other questions, please let us know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ghassen
Posts: 2
Joined: Thu Jun 18, 2020 7:51 am

Re: Conditionally copying installed files to APPDIR based on installation language

I have a similar problem:
1- I want to set a condition for a folder and its content without having to go through all subfolders and files.
I tried to create a feature for the folder but this is not working!
2- The folder is linked to an IIS website, so should I set a condition in IIs and a condition for folder installation?

Thanks in advance.
Catalin
Posts: 6592
Joined: Wed Jun 13, 2018 7:49 am

Re: Conditionally copying installed files to APPDIR based on installation language

Hello,

As you may already know, each file you add into your package ("Files and Folders" page) is assigned to a component (in the "Organization" page).

Basically, if you want to condition an entire folder, you would have to condition each component of each file from that folder.

This would take quite some time if your folder contains many files.

In Advanced Installer, you can achieve this by following the next steps:

- go to "Files and Folders" page

- select your folder

- click on the "Condition Files" button from the ribbon
ConditionFiles.png
ConditionFiles.png (228.7 KiB) Viewed 3066 times

This should set the condition automatically for all the components assigned to the files from your folder.

Hope this helps!

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

Return to “Common Problems”