2

Overview

We are currently using installsheild 2012 to create a basic MSI package to deliver our software to clients.

I am a self taught with installsheild so I doubt I will be following best practises I do however possess a reasonable understanding of custom actions, installscript and dialogs. I am a bit unsure on the directory editor and property manager so if these are required then please go slowly.

During the install the user has requested that they be able to install one of our folders to a different drive on their system as it is filled with logging information and has the potential to be quite large. So this folder needs to be installed outside the INSTALLDIR.

Aim

I wish to create a dialog box which would enable the user to choose an install location for this folder during the install.

This process needs to be accomplished through the user interface as it needs to be quite flexible as the contents of the logging folder can change from client to client.

So ideally I would like a folder to be visible in the application data\ files and folders\Destination Computer, section of the interface which would allow whoever comes to maintain the project after me to simply drag and drop the folders in there.

Although the management of the folders will need to be done through the user interface the process behind this i.e. choosing the folder and then copying over the files can be achieved in any way as long as I have a few pointers to help me out

What I have tried

1.Installscript & Custom Action- I wrote a custom action to using the AskPath which would take the location of where the user chose to install the Log folder and then created a directory there. I would hard code the contents of the log folder in installscript (however as the folder structure can change this approach became too hard to maintain)

2.Components & Features – I tried to use the log folder as a separate feature and have its own component but I couldn’t get the property to carry over from the dialog and link the component with the dialog which would choose where to install the log folder.

3.Pre-requisites – I looked online and found that I might be able to install the log folder via the pre-requisites manager by Zipping up the log folder into a self extracting Zip( I haven’t had any luck with this yet and I am hoping that there is a cleaner way)

I think I may have come close in some of my attempts to doing what I wanted but I kept hitting dead ends.

Any help would be greatly appreciated and thank you for reading I know it’s a long post.

Cawston

Oliver843
  • 25
  • 1
  • 8

1 Answers1

1

Just do this:

Create two directories in your installer:

INSTALLDIR = [ProgramFilesFolder]Company\Product LOGDIR = [INSTALLDIR]Logs

Then take a look at the Destination Folder dialog. Clone all of the controls that make the various icons, text and browse button for INSTALLDIR.

Change the display text from [INSTALLDIR] to [LOGDIR]. Next copy the control events on the Browse button and change the [_BrowseProperty] value to LOGDIR instead of INSTALLDIR.

That's it. LOGDIR will start off a child of INSTALLDIR but if the user presses Browse and changes it then that relationship is broken. You can then change INSTALLDIR and it won't change LOGDIR.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • Thanks @Christopher for your help. I followed the instructions and set up the two Directories in the Directory Table. I then made the changes to the _BrowseProperty value. I ran the install and all the dialogs displayed and it worked as I thought. However the logs folder is not created and only the INSTALLDIR folders are loaded onto the clients system. I then wanted to see if the LOGDIR property was being populated. So I looked at the installer log and the value is being populated and apparently the folders are being copied but they don't exist Thanks again Cawston cant fit in anymore:( – Oliver843 Jul 18 '12 at 10:53
  • If a folder doesn't have any components with files or subfolders then it needs to have an entry in the CreateFolder table. InstallShield usually handles this for you but you can check it by going into the direct editor and select that table. Both columns are forign keys to said Directory and Component tables. This teaches the installer that when a certain component is installed that a certain directory needs to be created. – Christopher Painter Jul 18 '12 at 13:42
  • Thank you @Christopher You have been a great help and have solved many an hour of future headache. – Oliver843 Jul 18 '12 at 14:14
  • If you aren't installing anything to that directory, make sure you test your repair. MSI has a way of only remembering directory properties if anything used them. Otherwise it might default back to being a subdirectory of INSTALLDIR during a repair. Ways around this is to either install a dummy file or do your own property persistance property so that the override value is remembered during subsequent transactions. – Christopher Painter Jul 18 '12 at 17:40
  • One of us is missing something, and it may be me because I only skimmed this answer, but the `DestinationFolder` dialog uses the `InstallChangeFolder` dialog, which, as far as I can tell, is hardwired to only update `INSTALLDIR` because it uses the `SetTargetPath` event, which doesn't accept a directory parameter, so must be hardwired to `INSTALLDIR`. – BlueMonkMN Sep 14 '15 at 20:52