We're using WiX version 3.0.4805.0.

We need to copy a directory recursively. 

Say, there are some user data files saved in the User's 'AppDataFolder', for 
example, something like "C:\Documents and Settings\user_login\Application 
Data\CompanyName\ProductNameA". Now we need to change our proudct name from 
ProductNameA to ProductNameB. Then we'll need to copy the whole user data to 
another folder called "ProductNameB". Otherwise, the application will not 
recognize the user settings and data because the application can't find them. 
Anyways, we need to copy them to the new spot.

I know there is a way to copy a file one by one. But in our case, there is no 
way for us to know the user's sub-folder name and file name on the installer 
build time. They may even have totally different folder structure and the 
number of files.

Here is just an example, for user 'John', his user data maybe something like 
these:
AppDataFolder\CompanyName\ProductA\UserJohn\profile.xml
AppDataFolder\CompanyName\ProductA\UserJohn\ui\settings.xml
AppDataFolder\CompanyName\ProductA\UserJohn\contacts\
AppDataFolder\CompanyName\ProductA\UserJohn\media\settings.xml
AppDataFolder\CompanyName\ProductA\UserJohn\media\audio\status.xml
AppDataFolder\CompanyName\ProductA\UserJohn\media\audio\clip1.wav
AppDataFolder\CompanyName\ProductA\UserJohn\media\audio\clip2.wav
AppDataFolder\CompanyName\ProductA\UserJohn\media\video\status.xml

For user 'Alice', her data maybe something like these:
AppDataFolder\CompanyName\ProductA\UserAlice\profile.xml
AppDataFolder\CompanyName\ProductA\UserAlice\brand.xml
AppDataFolder\CompanyName\ProductA\UserAlice\history\history1.xml
AppDataFolder\CompanyName\ProductA\UserAlice\history\history2.xml

So we need a way to "just recursively copy a directory from one spot to another 
no matter what are inside the directory".

I tried something like these:
<Directory Id='TARGETDIR' Name='SourceDir'>
....
    <Directory Id="CompanyFolder" Name="MyCompany Inc.">
        <Directory Id="MySource" Name="Good Product">
        </Directory>
        <Directory Id="MyTarget" Name="Great Product">
        </Directory>
        <Component Id="CopyUserDataDir" Guid="..." >
            <CopyFile Id="CopyDataDir" SourceName="*" SourceProperty="MySource" 
DestinationProperty="MyTarget" />
        </Component>
    </Directory>
</Directory>

But I quickly got some errors:
error LGHT0204: ICE18: KeyPath for Component: 'CopyUserDataDir' is Directory: 
'CompanyFolder'. The Directory/Component pair must be listed in the 
CreateFolders table.
error LGHT0204: ICE38: Component CopyUserDataDir installs to user profile. It 
must use a registry key under HKCU as its KeyPath, not a file.
error LGHT0204: ICE64: The directory CompanyFolder is in the user profile but 
is not listed in the RemoveFile table.
error LGHT0204: ICE64: The directory MySource is in the user profile but is not 
listed in the RemoveFile table.
error LGHT0204: ICE64: The directory MyTarget is in the user profile but is not 
listed in the RemoveFile table.

Can someone provide a solution about how to do it in WiX 3.0? Some code example 
is welcome.

Thanks you all.

/Brian



      __________________________________________________________________
Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your 
favourite sites. Download it now at
http://ca.toolbar.yahoo.com.
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to