WiX Attributes: CopyFile

During the installation process, I want to optionally copy some .ini files from SOURCEDIR to TARGETDIR, which means that the .msi file is in the destination folder to which the application is installed from the directory.

I did <CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini" Delete="no" /> , but it seems to be doing nothing. The log file does not help much.

I managed to make a much more complicated script with CopyFile, and I'm just puzzled by this simple one.

Edit: I have these rows in the MoveFile table:

  | FileKey | Component | SourceName | SourceFolder | DestFolder | Options
 | CopyIniFile | CoAppLicAndIni | Dreem15.ini | SOURCEDIR | INSTALLDIR | 0
 | MoveDataFile | CoAppLicAndIni | Dreem10_Personal.mdf | DB_DIR10 | INSTALLDIR | 0 

and the second one works. DB_DIR10 searches the registry, for example,

  <Property Id = "DB_DIR10">
     <RegistrySearch Id = 'DbDirSearch10' Type = 'raw' Root = 'HKLM' Key = 'Software \ $ (var.CompanyName) \ $ (var.MsdeInstance)' Name = 'Dreem10_Personal' />
 </Property> 
+7
wix
source share
2 answers

According to the Windows Installer documentation for the sourcedir property, it points to "the root directory containing the source file or source file of the installation package tree".

Thus, either you did not know that SourceDir is a predefined property of the Windows installer, or you are trying to copy an unpacked file from the installation media that contains msi. In the latter case, it would probably be wiser to install the file as a regular component so that it is deleted correctly.

Edit: I tested the "copy from installation media" script and it worked for me. In addition, I installed using

 misexec /lvx* install.log /i mymsi.msi 

and the log showed that the file is being copied. What does the magazine say in your case?

Edit2: While CopyFile worked for me, the best solution is to add uncompressed media to your wxs as follows:

 <Media Id='2'/> 

And then adapt the File element for the custom configuration file as follows:

 <File Source='path\to\default\config.ini' Compressed='no' DiskId='2' /> 

This will force the installer to look for config.ini in the same folder as msi, combining the advantages of customization and clean uninstallation.

+3
source share

Can you use DestinationDirectory="INSTALLDIR" instead, or do you need to create properties on the fly ??

WIX Wiki CopyFile Element

This wxs puts the file in MSI

 <Component Id="myIni.ini" Guid="*"> <File Id="myIni.ini" Name="myIni.ini" KeyPath="yes" Source="!(wix.Files)\myIni.ini"> <CopyFile Id="CopyIni" DestinationProperty="TARGETDIR" /> </File> </Component> 
0
source share

All Articles