one of my components installs a folder (with sub folders and files) into "C:/Program Files (x86)". Following error message is shown to the user during the installation process, in case some target file the installer wants to update is currently being used:

Error copying file from packed archive
C:/path/to/Setup.exe to C:/Program Files (x86)/some/target/file

[Abort] [Retry] [Ignore]

After aborting the installation via the "Abort" button, the install log reads:

----- snip -----
Unpacking files
File is locked. Failed to overwrite C:/Program Files (x86)/some/target/file
----- snip -----

I'd like to catch that error, to be able to

  • display a customized error message, and
  • to return a specific error code via the "exit" action.

I didn't find a place to put an <onErrorActionList> within my <component>, or within the component's <folder>, though.

Can it be done?

Dirk Stegemann

asked 26 Mar '13, 12:52

Dirk%20Stegemann's gravatar image

Dirk Stegemann
accept rate: 31%

Is that error happening with the regular installation process or when using an <unpackFile> action? If it is the former, it is not possible to customise the behaviour but you could check if the file is locked before the unpacking starts:

    <showWarning text="File ${installdir}/some/target/file is locked! Please close the application before continuing">
               <fileIsLocked path="${installdir}/some/target/file"/>

Would something like the above work for you? Could you provide us with more details about the scenario in which this is happening?


answered 26 Mar '13, 13:38

juanjo's gravatar image

juanjo ♦♦
accept rate: 23%

The approach given above would only work, I guess, if the <fileIsLocked> action could operate recursively, to check all the target folder's subfolders and files.

The installer uses <processTest> and <windowsServiceTest> to prevent the installer from running, in case the applications about to be updated are running; but it is not always possible to ensure that none of the resources about to be updated aren't currently being used.

(27 Mar '13, 12:32) Dirk Stegemann

Alternatively, is it possible to prevent the user from clicking [Ignore]?

After the user ignores unpacking errors, which I cannot detect, the installer assumes that everything is fine. If the user instead clicks the [Abort] button, I can take care of cleanup and error codes from within the <installationAbortedActionList>.

(28 Mar '13, 08:37) Dirk Stegemann

I too would like to be able to disable or catch the use of 'Ignore'. There is very little in my installation which is safe to ignore, once selected. If I can't disable or trap 'Ignore', I'll have to write post-installation code to verify the installation. I use a commercial installer to avoid having to do things like this.


answered 22 Jul '13, 11:46

InstallBoy's gravatar image

accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 26 Mar '13, 12:52

Seen: 3,129 times

Last updated: 22 Jul '13, 11:46