Thanks for the assistance to date, it's appreciated.

I'm at a point now where I've created a custom action DLL using a .NET
class library that I invoke as follows:

<CustomAction Id="CreateDirs" BinaryKey="CREATE_DIRS"
DllEntry="CreateDirectories" Execute="immediate" Return="check" />
<Binary Id="CREATE_DIRS" SourceFile="WiXCustomActions.CA.dll" />

<EnsureTable Id="DuplicateFile" />
<InstallExecuteSequence>
    <DuplicateFiles/>
    <Custom Action="CreateDirs" Before="CostInitialize"
Overridable="yes">NOT Installed</Custom>
</InstallExecuteSequence>

The "CreateDirectories" method does the job of adding TEMPORARY entries
to the Directory table and the DuplicateFile table.  The insert
statements are invoked (more or less) like this:

session.Database.Execute("INSERT INTO `Directory` (`Directory`,
`Directory_Parent`, `DefaultDir`) VALUES ('DIR_HH_01', 'DIR_ROOT',
'directory01') TEMPORARY");
session.Database.Execute("INSERT INTO `DuplicateFile` (`FileKey`,
`Component_`, `File_`, `DestName`, `DestFolder`) VALUES ('FILE_DUP_1',
'COMPONENT_1', 'FILE_1', NULL, 'directory02') TEMPORARY");

The above code is invoked by the installer (I have a bit of debug
logging to confirm values, etc), but the DuplicateFiles action doesn't
see any entries in the table!  The MSI log shows:

Action 17:54:33: DuplicateFiles. Creating duplicate files
Action 17:54:33: WriteRegistryValues. Writing system registry values
...

I verified that "COMPONENT_1" and "FILE_1" correspond to a component and
a file that are both installed during the installation process.  The
"FILE_1" file lives in a directory called "directory01" and I would like
to duplicate it to directory02.  I also confirmed that the installer
completes successfully, installing all files (except the duplicates). 
None of the extra directories I added to the Directory table are created
either.

It's as though my insertions into those tables is having no effect on
the installer.  Perhaps it's something to do with the TEMPORARY
keyword?  Or maybe the time at which the CA is invoked?  I'm not clear
on this yet.

Any ideas would be appreciated!

Keith




[ Original Message ]
*Date:*         7/7/2010 10:43:42 AM
*From:*         os...@live.com
*To:*   wix-users@lists.sourceforge.net
*CC:*   
*Subject:*      Re: [WiX-users] Dynamic directory creation

> 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
>   
------------------------------------------------------------------------------
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