mstarnaud
Posts: 45
Joined: Mon Apr 15, 2013 9:44 pm

SourceDir goes in APPDIR in silent install?

Hi

So I have 2 folders to deploy. One is in APPDIR and the other is property-based on a property called PROP_SETUPFOLDER. I have the following actions:
- after Wizard Dialog's Searches : set PROP_SETUPFOLDER to [SourceDir] if UILevel > 2
- after Install Execution's Searches : set PROP_SETUPFOLDER to [SourceDir] if UILevel = 2
- after Install Execution's Searches : set [IIsWWWRootFolder]\[PROP_VIRTUALDIRECTORYNAME] if UILevel = 2
In the dialogs, I ask the user for the PROP_VIRTUALDIRECTORYNAME value.
Let's suppose my MSI is in C:\Temp.

if I run the installer normally (with dialogs) and enter the virtualdirectory name of MyApp when asked by the dialog, everything works as expected : the contents of PROP_SETUPFOLDER are copied in C:\Temp and the contents of APPDIR are copied to wwwroot\MyApp.

If I run in quiet mode (command line with /quiet) and set the virtual directory property to MyApp as a command line argument, then it almost works : the contents of APPDIR is copied to wwwroot\MyApp (good!) but the contents of PROP_SETUPFOLDER are copied to a folder called wwwroot\MyApp\PROP_SETUPFOLDER (this is bad, it should go to C:\Temp and not create a new folder called PROP_SETUPFOLDER).

And just to be clear : In Files&Folders, there is PROP_SETUPFOLDER which contains Script1.txt. I expect it to go to C:\Temp\Script1.txt. But in quiet mode, the result is wwwroot\MyApp\PROP_SETUPFOLDER\script1.txt.

It could be a problem with the way I set the value of PROP_SETUPFOLDER in a custom action after Install Execution's Searches. But I suspect there is something else happening. I checked the resulting log file and the SourceDir property seems correctly set to C:\Temp even in Quiet mode, at least at the end of the installation. Note that I have to set the property's value before the Install Execution's CostFinalize step, otherwise I get an error : Could not access network location ".". I tried putting my action right before the CostFinalize step, but I still get my wrong folder bug.
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: SourceDir goes in APPDIR in silent install?

Hi,

I'm not so sure what is your scenario, but it is a little unusual to install a file in the MSI's directory. If, for example, your MSI file is on a CD\DVD, the script cannot be installed in the MSI folder ([SourceDir]) on the CD.

However, in order to achieve what you want you can replace [SourceDir] value from the the "Set installer property" custom action with [APPDIR] then, add a "Set directory path" custom action after the "Install Execution Stage -> Preparing" action group and set its value to [SourceDir]. Also, the "Set directory path" custom actions should be executed only on "Install", otherwise you will get an error on uninstall because the PROP_SETUPFOLDER property cannot be set to [SourceDir] on uninstall.

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mstarnaud
Posts: 45
Joined: Mon Apr 15, 2013 9:44 pm

Re: SourceDir goes in APPDIR in silent install?

Thanks for your reply. This behavior seems as unusual as my request, but your solution worked. Thank you!

Also, FYI, I noticed in my "buggy" example that the PROP_SETUPFOLDER folder did not get deleted on uninstall.
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: SourceDir goes in APPDIR in silent install?

Hi,

Indeed, the folder is not deleted on uninstall because the PROP_SETUPFOLDER property cannot be set to [SourceDir] on uninstall.

However, in order to remove the files created in the PROP_SETUPFOLDER folder you can store its related property in a registry value, then create a search which takes this value from the registry and stores it in another property (i.e. PROP2). Then go in the Custom Actions page and create another "Set directory path" custom action right under the one created earlier with the following settings:
  • Directory: PROP_SETUPFOLDER
    Value: PROP2
    Executioin Stage Condition: only Uninstall
Let us know if this worked.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”