8

On install I want to optionally copy some .ini files from SOURCEDIR to TARGETDIR which means from the directory the .msi file is located to the destination folder the app is setup to.

I did <CopyFile Id="CopyIniFile" DestinationProperty="INSTALLDIR" SourceProperty="SOURCEDIR" SourceName="Dreem15.ini" Delete="no" /> but it seems it's not doing anything. The log file is not helping much.

I've been successful in doing a much more elaborate scenario with CopyFile and I'm baffeled by this simple one.

Edit: I have these rows in 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 is working. DB_DIR10 is searched in registry like this

<Property Id="DB_DIR10">
    <RegistrySearch Id='DbDirSearch10' Type='raw' Root='HKLM' Key='Software\$(var.CompanyName)\$(var.MsdeInstance)' Name='Dreem10_Personal' />
</Property>
wqw
  • 11,771
  • 1
  • 33
  • 41

2 Answers2

4

According to the windows installer documentation for the sourcedir property, it points to "the root directory that contains the source cabinet file or the source file tree of the installation package".

So either you were not aware that SourceDir is a predefined windows installer property, or you are trying to copy an unpackaged file from the installation medium that contains the msi. In the latter case it would probably make more sense to install the file like a normal component so that it will be properly uninstalled.

Edit: I've tested the "copy from install medium" scenario and it worked for me. Also, I've installed with

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

and the log did show the file being copied. What does the log say in your case?

Edit2: While CopyFile worked for me, a better solution is to add an uncompressed medium to your wxs like this:

<Media Id='2'/>

And then adapt the File element for your customizable config file like this:

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

This will make the installer look for config.ini in the same folder as the msi, combining the advantages of customizability and a clean uninstall.

Wim Coenen
  • 66,094
  • 13
  • 157
  • 251
  • Exactly. What I want to do is to give support a chance to customize setup by putting an ini file next to msi file. This will contain some per client settings. Obviously it could be done with a transformation (mst) for each client, but don't think support guys can create these easily. – wqw Jan 21 '09 at 22:22
  • It does not show anything is happening. MoveFiles is scripted but later no FileCopy occurs. How did you make it exactly? Snippet? – wqw Jan 21 '09 at 22:56
  • I just copy-pasted your snippet to test it and it worked for me... But you can give the superior "uncompressed medium" option a try as I explain above. – Wim Coenen Jan 21 '09 at 23:37
  • Oooops, my bad. I feel stupid: wrong file name! :-)) It's working here too. I came up with second media too (in exasperation) and will give it a try. For now I already had RemoveFile *.ini for the unistall part. Thanks for the tips. – wqw Jan 21 '09 at 23:51
1

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

WIX Wiki CopyFile Element

This wxs, will put the file in the 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>
Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
CheGueVerra
  • 7,849
  • 4
  • 37
  • 49