tags:

views:

1637

answers:

2

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

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>
CheGueVerra
It's under a File or Component Parent Element ?
CheGueVerra
CopyFile is under a separate Component parent as of now. Will do a custom action if this can't be done easily.
wqw
+2  A: 

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
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
It does not show anything is happening. MoveFiles is scripted but later no FileCopy occurs. How did you make it exactly? Snippet?
wqw
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
BTW I'm using wix v3.0
Wim Coenen
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