[wix-users] How to Update existing configuration

Carlos Sosa carlos.sosa.us at outlook.com
Wed Apr 26 15:22:25 PDT 2017

Hello, Well I have been trying so many things for hours with no luck.
ANY help is really appreciated.

I tried custom actions (no success)
I tried copyfile (no success)
I tried a Bundle (can create the back up using a .bat but having other problems like version and overwriting the old .config)

I think I'm being impatient and just jumping around too much, so I'm going to go back to the copyfile option, because the only thing I want to do at this point is to BackUp the .config before the new one overwrites it.
I need to copy the configuration file "myApp.Config" form the Installation directory (when doing an upgrade the file is already there) and copy it some where else.

1. This is giving me errors: SchemaValidationFailed....

    <Property Id="SourceFileDir" Value="C:\Program Files (x86)\Packsize PackNet.Cube\" />
    <Property Id="DestFileDir" Value="C:\Users\%username%\Desktop\MyAppBackup\" />

      <Component Id="Component1" Guid="*" Directory="INSTALLFOLDER">
      <File Id='FileToCopy' LongName='myApp.config' Source='SourceFileDir'> 
       <CopyFile Id='CopyTask' DestinationProperty='DestFileFolder' DestinationLongName ='myApp.config' FileId='FileToCopy'/> 

Once that is fixed, how/where do I call it? From within my Feature Section?

Best Regards.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Farrukh Waheed
Sent: Wednesday, April 26, 2017 12:00 AM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] How to Update existing configuration

Consider using Util extension, which has methods: XMLConfig and XMLFile.
First one can be used in your case.
>From "preserve the settings", I guess you need to backup existing config file. You could use WIX's  CopyFile to make a copy of existing one.

On 26 April 2017 at 04:03, Carlos Sosa <carlos.sosa.us at outlook.com> wrote:

> Hello WIX community, I have a xml configuration file as follows:
> <Fragment>
>     <!--
>         Permanent="yes" Don't remove the file
>         NeverOverwrite="yes" Don't write the file if it already exists
>         -->
>     <ComponentGroup Id="ExeConfig" Directory="INSTALLFOLDER" >
>       <Component Id="MyCompany.MyProgram.exe.config" Guid ="*"
> Permanent="yes" NeverOverwrite="yes">
>         <File Name="MyCompany.MyProgram.exe.config"
> Source="$(var.MyProgram.TargetPath).config" KeyPath="yes"/>
>       </Component>
>     </ComponentGroup>
>   </Fragment>
> We added a couple of settings to it, how can I add the 2 settings to 
> the "old" xml during upgrade?
> I need to preserve the setting for the previous version, what would 
> the best route to accomplish this be?
> Best Regards.
> ____________________________________________________________________
> 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