Passing Application Folder to Custom Action - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

w_bingham
Posts: 10
Joined: Fri Feb 18, 2011 8:36 pm

Passing Application Folder to Custom Action

I'm trying to get my package to copy the current contents of the install target directory to a predetermined folder prior to installation but having trouble getting the custom action to work. If I use the [appdir] it fails, if I use a custom search to create a property to pass it also fails (likely due to not being installed yet). I can only get the custom xcopy action to work if I use the actual path. This won't work as the customers have the ability to select the application folder which will point to the manually installed set of files that need to be copied to the backup location. IE this works as a command line for the XCOPY Launch File Custom Action:

D:\inetpub\wwwroot\*.* /E /I /Y "[ProgramFilesFolder]\WWW_BACKUP"

But this does not:

[appdir]\*.* /E /I /Y "[ProgramFilesFolder]\WWW_BACKUP"

Any Suggestions?

Once I get this working I need to be able to copy these files back to the original location if my installer is uninstalled. Having trouble getting it copy the files after the uninstall has been completed. What step in the Install Execute Sequence should I create this custom action under so the files are copied back as the last action of the uninstall?

TIA
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Passing Application Folder to Custom Action

Hello,

If you want to create a backup of your files you will have to schedule your custom action after the install is complete and before the uninstall starts. This is the only time you can have access to your files on the hard drive. The package itself contains only the deconstructed binary version of your files.

This being the case you will have to schedule your custom actions like this:
  • for uninstall anywhere before the "Uninstall" standard action with an execution condition set to:

    Code: Select all

    REMOVE = "ALL"
  • for install anywhere after the "Install" standard action with an execution condition set to:

    Code: Select all

    NOT Installed
Also, this is the correct formatted reference to the APPDIR( uppercase letters ) folder is:

Code: Select all

[APPDIR]
Any formatted reference to this property must be within a custom action scheduled after the CostFinalize standard action. Here is an article that explains this.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
w_bingham
Posts: 10
Joined: Fri Feb 18, 2011 8:36 pm

Re: Passing Application Folder to Custom Action

I am wanting to back up the current contents of the directory BEFORE the files from the installer overwrites them. What step can I use that can still utilize the [APPDIR] property?

For Uninstall I want to PUT BACK the files that were backed up previously AFTER the files placed by the installer are removed. I need to know what step will allow this. So far every one I have used restores the files and the uninstalls them.

*EDIT*
And sorry but I was using [APPDIR] in caps but it was still failing, error code 4 whatever that means. I see the APPDIR being resolved much earlier in the log but for some reason my use of it as shown above isn't working.
w_bingham
Posts: 10
Joined: Fri Feb 18, 2011 8:36 pm

Re: Passing Application Folder to Custom Action

OK figured out partial fix. Found out trailing slash after [APPDIR} was causing the error. CMDLINE Should have read:

[APPDIR]*.* /E /I /Y "[ProgramFilesFolder]\WWW_BACKUP"

Still need to know what step i need to put the restore function in to have it run after the Uninstall routine has removed the files the installer placed.

Any Help??
w_bingham
Posts: 10
Joined: Fri Feb 18, 2011 8:36 pm

Re: Passing Application Folder to Custom Action

OK Never Mind. Figured out the last part myself as well. Need to add my restore custom action to the Remove Folders standard action. Now the backing up of existing files as well as their restoration after uninstall goes off without a hitch. Thanks anyway.

Return to “Common Problems”