[wix-users] Install initial config file but none after that unless version updated

Andreas Hirth a_hirth at foxitsoftware.com
Wed Feb 22 04:56:13 PST 2017


Think of the following scenario.

Version 1: initial -> NeverOverwrite="yes"
Version 1.1: no change needed -> NeverOverwrite="yes"
Version 2: change needed -> NeverOverwrite="no"
Version 2.1: no further change needed -> NeverOverwrite="yes"

Now, what if the customer wants to upgrade from 1.1 to 2.1 which has 
NeverOverwrite set to "yes" again?

Futhermore this approach is not reliable anyway, because you do not 
force Windows Installer to overwrite the file if you set 
NeverOverwrite="no". Instead the replacement rules apply which rely on 
the modification dates for unversioned files (like XML files). So if 
your customer changed his local copy of the config file and the 
modification date happens to be later than for the file that is 
contained in your installer, it will not be replaced. There are tricks 
to enforce the replacement of unversioned files (by providing a fake 
version in the file table), but still you would face the problem noted 
above.

Best,
Andreas


Am 20.02.2017 um 22:56 schrieb Johnny Smith:
> I've set the Component Id NeverOverwrite and Permanent properties to Yes. In
> the future, If I need to overwrite the file, I'll just change the
> NeverOverwrite to No. That seems to have done the trick for me. Please let
> me know if there are shortcomings to this approach.
>
> <Component Id="EDI_Management.exe.config"
> Guid="a69977a4-1a35-4aa7-a23d-a12bcc75ace1" NeverOverwrite="yes"
> Permanent="yes">
>    <File Id="EDI_Management.exe.config" Name="EDI Management.exe.config"
> Source="$(var.EDI Management_TargetDir)EDI Management.exe.config"/>
> </Component>
>
> Regards,
> Johnny
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
> Hoover, Jacob
> Sent: Monday, February 20, 2017 3:43 PM
> To: WiX Toolset Users Mailing List
> Subject: Re: [wix-users] Install initial config file but none after that
> unless version updated
>
> Config file is XML, so you should be able to use WiX CA's to update it via
> XmlFile. I'm fairly certain it is safe as in it won't trigger Windows
> Installer into thinking the user modified the files.
>
> Depending on when you schedule RemoveExistingProducts, you could read the
> desired values before removal of the existing and then write the values
> after install of the new.  It may be possible if REP is scheduled later that
> the file would just stay, but I forget the rules behind a non-versioned
> file. (IE, is it just the last modified time matching that lets WI skip the
> file, or would it also hash.)
>
> As for adding another parameter, I'd do that with a XmlFile CA as well.
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of
> Johnny Smith
> Sent: Monday, February 20, 2017 2:15 PM
> To: wix-users at lists.wixtoolset.org
> Subject: [wix-users] Install initial config file but none after that unless
> version updated
>
> I need to install the application.exe.config file when the application is
> first installed; however, after the first installation, I want to manage the
> updates to the config file based on the version number of the file. How do I
> accomplish this?
>
>   
>
> I put connection string information in the config file. So, I don't want to
> overwrite the user's connection string information each time an update is
> installed but I would like the option to overwrite the file should another
> parameter be added to the file during a later update.
>
>   
>
> Johnny Smith
>
> President
> CenGen Technologies, Inc.
> P.O. Box 2037
> Mansfield,TX 76063
> Ph: (682) 518-9251
>
> W: http:// <http://www.cengentech.com/> www.cengentech.com
> <http://www.cengentech.com/>
>
>   
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/




More information about the wix-users mailing list