My recommendation would be to add an immediate custom action in the
InstallExecuteSequence table before CostInitialize that adds "temporary"
rows to the DuplicateFile table and "temporary" rows to the Directory table.
You would also need the following authoring:

<InstallExecuteSequence>
  <DuplicateFiles/>
</InstallExecuteSequence>

<EnsureTable Id="DuplicateFile"/>

You should also save the parameters for your custom action so that they can
be retrieved when repairing or uninstalling so your dynamic directories can
be cleaned up/upgraded as appropriate.

See http://www.joyofsetup.com/2007/07/01/semi-custom-actions/ for the
concept of using native functionality to do non-native things. This tends to
be much more authorable and reliable than trying to implement deferred
actions and getting rollback, etc. working in every case of repair, install,
removal, both kinds of upgrade, etc.

Such an immediate action can be tested using Lux as well, so you get
testability as a bonus.

-----Original Message-----
From: Keith Hassen [mailto:keith.has...@gmail.com] 
Sent: Wednesday, July 07, 2010 6:03 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Dynamic directory creation

Hi,

I am faced with a problem of building an MSI that requires a set of
directories to be created during installation.  These directories are
all prefixed with a common string (eg "folder") followed by a sequence
number (eg "01") so that their final construction might be something
like "folder01", "folder02", etc.  I need to place the same executable
in each of these generated directories, but the number of directories
isn't known until install time.  I would like to prompt the user for
that number during the setup and then dynamically build the directories.

My original assumption was that WiX simply couldn't do this task because
of the dynamic nature of the problem.  I assumed that I'd have to write
a batch script that would do this work for me: my approach was to always
generate 1 directory, and then use a CA to invoke a batch script that
would copy the directory as many times as was needed.

I thought I'd post this problem to this list to see if there were other
solutions (using WiX or otherwise) that might be cleaner or more effective.


Keith

----------------------------------------------------------------------------
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to