/build/static/layout/Breadcrumb_cap_w.png
05/11/2017 1494 views
I have an application I am packaging which has additional configuration steps on initial launch of the application, post install . One of the challenge questions is to “specify” the location of a specific file if it exists on the machine. The other option is to “install” the file if not on the machine, created as part of the install. I need my package to detect if the file exists on the machine. If detected, it should leave the existing file for use with this install. If not detected, then the files need to be installed. I am compiling my ISM with the files in question showing in the folder. With the files existing on the machine for my capture, my thinking is that this should allow for a custom action which would detect the presence of the files.


Can a custom action be added to detect the presence of a file and install the file if not there?


I am very green when it comes to custom actions and especially so when vbscripts are involved. Please be as specific as possible. Any direction is greatly appreciated.

I am using Admin Studio InstallShield 2015 Premier.

Thank you in advance!




0 Comments   [ + ] Show comments

Comments


All Answers

0
It the mentioned file is in a per-machine location (so is not present under C:\Users\...folder) you can use the AppSearch (+DrLocator and Signature) table(s) to create a file search criteria and store the result in a PROPERTY. Then you can use this PROPERTY as a Condition for a component with the new file (the one that needs to be installed if does not already exist).
In general, PROPERTY from AppSearch is set to TRUE if file exists otherwise it is FALSE. In your case you need to install the new file if does not already exist on a machine so you should use "NOT PROPERTY" (NOT FALSE = TRUE so component will be installed).
In the InstallShield you can use a System Serach wizard described for example --> HERE<--.

If the file is in the User's profile then I would use a VBS CustomAction and Advertised Shortcut. I would install the file to some TMP location (eg. C:\ProgramData\AppName\ConfigFile\) and a VBS CA would copy the file if needed.
Answered 05/11/2017 by: rad33k
Third Degree Brown Belt

0
Why not having the file in question in a separate component by its own and setting it as a KEYPATH. That way, installer will install only if the file is missing. You can top that up with setting the component attribute to NeverOverwrite(128)
Answered 05/12/2017 by: dragosCI
Senior White Belt

  • Bingo! Good catch dragosCI, this is definitely the easiest way.
    @OP You just need to take into account the file replacement rules:
    https://msdn.microsoft.com/en-us/library/windows/desktop/aa368267(v=vs.85).aspx