Another option is to use the <RemoveFile/> element tied to the same
Component as your <File/> element. This will always clear out the
existing file prior to the current install writing the new one. Works
for rollback and uninstall.

<Component Id="Filetxt" DiskId="1" Guid="<someguid>">
         <RemoveFile Id="Remove_Filetxt" Name="File.txt" On="install" />
         <File Id="Filetxt" Name="File.txt" Source=".\data\File.txt" />
</Component>

The RemoveFiles action is always scheduled before the InstallFiles
action by default, so as long as you don't change that sequence in
InstallExecuteSequence then it should work fine. I consider this the
functional equivalent of the InstallShield "Always Overwrite" setting.




-----Original Message-----
From: McCain, Jon [mailto:jon.mcc...@inin.com] 
Sent: Tuesday, October 18, 2011 5:33 AM
To: General discussion for Windows Installer XML toolset.
Cc: McCain, Jon
Subject: Re: [WiX-users] Using wix how to always overwrite a file?

You could write a CA to put the file in a temp location each time, check
the creation date on both (or some other unique variable), and then move
it into the proper directory. You would have to write additional code to
handle backup of the pre-existing file in the instance of an update
removal or an total uninstall.

Jon W. McCain | Software Engineer - Install
phone & fax +1.317.715.8462 | jon.mcc...@inin.com

Interactive Intelligence Inc.
Deliberately Innovative
www.inin.com



-----Original Message-----
From: Pandurangan, Vasanthakumar
[mailto:vasanthakumar.panduran...@hp.com] 
Sent: Tuesday, October 18, 2011 6:50 AM
To: wix-users@lists.sourceforge.net
Subject: [WiX-users] Using wix how to always overwrite a file?

Hi,

There are 2 msi installer files, both of them write the same file in the
same location. Objective is to overwrite the file by the latest
installer.
As of now, the file is not versioned. So Installer re-writes the file
only when the modified date is older than created date of the existing
file.

How to change it so that this file is always over written by the latest
installer? What should be the value of "DefaultVersion" attribute in
File tag?
I'm unable to find any example of Wix code which uses "DefaultVersion"
attribute in File element.

Thanks in Advance,
Vasanth

------------------------------------------------------------------------
------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------
------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users



------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to