Thank you. I'll try to go on with this. 
Just one last question to make it clear : To make it work I need to move the
creation of All the xml config nodes to WIX (.wxl) file, and simply forget
about copying the app.config file from the source like this
<File Source="../$(var.buildDir)/myapp.config" Name="myapp.config"
Vital="yes" /> ? 

Or maybe I didn't understand the concept at all?


cemiles wrote:
> 
> 1) I'll try and do you one better.  Here's how I update a specifc node
> (key
> or value)...
> 
> <util:XmlConfig Id="SetPort" Action="create" Node="value" Name="value"
> ElementPath="//appSettings/[EMAIL PROTECTED]'port'[\]]"
> VerifyPath="//appSettings/[EMAIL PROTECTED]'port'[\]]" Sequence="1"
> File="[INSTALLDIR]Web.config" On="install" Value="[CONFIGPORT]" />
> 
> [INSTALLDIR] should be whatever your directoryref is to that component for
> the config file...
> 
> And you'll probably want 2 xmlfile elements to create the 2 elements
> (newSection & add).  I could be wrong on this part, haven't tried adding
> in
> new sections before, but this is a start.
> 
> And my config file looks something like this...
> 
> <?xml version="1.0"?>
> <configuration>
>     <appSettings>
>         <add key="port" value="12345"/>
>   </appSettings>
> </configuration>
> 
> And for the dialog you could give the user the choice to update or not to
> update...
> 
>         <!-- RadioButton Group values: Config=1; Bypass=2 -->
>         <Control Id="RadioButtons" Type="RadioButtonGroup" X="35" Y="65"
> Width="301" Height="66" Property="CONFIGCHOICE">
>           <RadioButtonGroup Property="CONFIGCHOICE">
>             <RadioButton Text="!(loc.WebConfigDlg_Radio1_Text)" X="0"
> Y="0"
> Width="300" Height="15" Value="1" />
>             <RadioButton Text="!(loc.WebConfigDlg_Radio2_Text)" X="0"
> Y="15"
> Width="300" Height="15" Value="2" />
>           </RadioButtonGroup>
>         </Control>
>         <!-- User enters PORT to listen for (Defaults to "12345") -->
>         <Control Type="Edit" Width="172" Height="15" X="155" Y="136"
> Id="ConfigPortValue" Text="[CONFIGPORT]" Default="yes"
> Property="CONFIGPORT">
>           <Condition Action="show">CONFIGCHOICE=1</Condition>
>           <Condition Action="hide">CONFIGCHOICE=2</Condition>
>         </Control>
>         <Control Type="Text" Width="112" Height="10" X="35" Y="139"
> Id="ConfigPortText" Transparent="yes" NoPrefix="yes"
> Text="!(loc.WebConfigDlg_Port)">
>           <Condition Action="show">CONFIGCHOICE=1</Condition>
>           <Condition Action="hide">CONFIGCHOICE=2</Condition>
>         </Control>
> 
> 2) You just need to include the old one and the new one will be installed
> as
> the user updates the settings.
> 
> 3) I've never seen this, but I'd lean towards 'no'
> 
> On Tue, Sep 9, 2008 at 11:17 AM, polan <[EMAIL PROTECTED]> wrote:
> 
>>
>> Thx for  your fast answer
>>
>> Ok - sorry for the unclear description. I didn't want to make it long -
>> let's do it more descriptive:
>> Here's the scenario (I'll use simplify pseudo code for the app.config):
>>
>> I have my application version 1.0.0 with app.config:
>> <configuration>
>> <databaseConfig>
>>    <add key="Server" value="localhost\MyDbEngine" />
>>    <add key="Database" value="MyDb" />
>>  </databaseConfig>
>> </configuration>
>>
>> The user gets the app and installs it. He changes the values as he's
>> pleased.
>> (i.e. he changes
>>    <add key="Server" value="localhost\MyDbEngine" />
>>    <add key="Database" value="FancyUserDbName" />
>> )
>> Now there is the next version 1.0.1 with app.config:
>>
>> <configuration>
>> <databaseConfig>
>>    <add key="Server" value="localhost\MyDbEngine" />
>>    <add key="Database" value="MyDb" />
>> </databaseConfig>
>> <newSection>
>>    <add key="newKey" value="newValue" />
>> </newSection>
>> </configuration>
>>
>> Users gets the installer (1.0.1). What I want it to do is install the
>> program preserving the values from .config file that already existed in
>> the
>> previous version (1.0.0) and adding all the new ones. I wouldn't like the
>> user being forced to write the "FancyUserDbName" once again to the file
>> (or
>> in the installer).
>>
>> As I understood from your answer there is a way to extract required
>> values
>> from the .config file that is being installed, show them in installers UI
>> and allow the user to edit it and write the effect into the final .config
>> file.
>> 1. If it is right could you write a bit more on how to do it? Or maybe
>> some
>> link to read about it? I am especially concern in the way of accessing
>> the
>> file that is being installed.
>>
>> 2 .Would it be also possible to use both the new .config file (in my
>> example
>> version 1.0.1) and the old one (1.0.0) together to fill the data in UI
>> accordingly to my needs?
>>
>> 3. Finaly is it possible to skip editing the values by the user and just
>> merge the new and old files? (I don't expect the wix to know how to merge
>> them - but maybe it is possible to do it via Custom Action?)
>>
>>
>>
>> cemiles wrote:
>> >
>> > You'll probably have to write up a dialog and have some edit fields set
>> to
>> > properties and pass those values entered onto the util:xmlconfig
>> element.
>> > That's been my approach.  Maybe I'm on the wrong track on what you are
>> > trying to do...
>> >
>> > On Tue, Sep 9, 2008 at 10:32 AM, Chad Miles <[EMAIL PROTECTED]>
>> wrote:
>> >
>> >> You can update the config file during the UI sequence and modify
>> >> keys/values.  Is that all you're trying to do?
>> >>
>> >> util:xmlconfig  element
>> >>
>> >>
>> >> On Tue, Sep 9, 2008 at 10:26 AM, polan <[EMAIL PROTECTED]> wrote:
>> >>
>> >>>
>> >>> I have some application settings (like database configuration etc.)
>> >>> stored
>> >>> in
>> >>> app.config file.
>> >>> As it is a standard .Net approach i haven't expected any troubles
>> with
>> >>> this
>> >>> and installer. I would like to make the newest version of the program
>> >>> available to the users via wix installer,  but I couldn't find a
>> simple
>> >>> way
>> >>> of updating the .config file without trashing the old settings
>> values.
>> >>> The perfect solution for me would be a way to merge somehow the old
>> file
>> >>> with the new one.
>> >>>
>> >>> I am thinking about several possible approaches (don't know if all
>> are
>> >>> possible)
>> >>>
>> >>> 1. Compare and merge old and new .config files using Custom Action
>> >>> A problem with this one is I can't get to access the new file (the
>> one
>> >>> that's gona be installed)
>> >>>
>> >>> 2. Backup old file using Custom Action and merge the backup with the
>> >>> freshly
>> >>> installed version using another (deferred) Custom Action
>> >>>
>> >>> 3. Instead of copying the .config file from source move creating it
>> to
>> >>> the
>> >>> wix (using XmlConfig or XmlFile tag)
>> >>> Don't know how to write conditional set/create values - is it
>> possible?
>> >>>
>> >>> 4. There is some other obvious way, which I can not see maybe?
>> >>>
>> >>>
>> >>> So in Your opinion what is the best approach for updating the .config
>> >>> file
>> >>> during the update/upgrade?
>> >>> Would moving some values from app.config to registry be better?
>> >>> --
>> >>> View this message in context:
>> >>> http://n2.nabble.com/Updating-app.config-tp1077780p1077780.html
>> >>> Sent from the wix-users mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>>
>> -------------------------------------------------------------------------
>> >>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> >>> challenge
>> >>> Build the coolest Linux based applications with Moblin SDK & win
>> great
>> >>> prizes
>> >>> Grand prize is a trip for two to an Open Source event anywhere in the
>> >>> world
>> >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> >>> _______________________________________________
>> >>> WiX-users mailing list
>> >>> WiX-users@lists.sourceforge.net
>> >>> https://lists.sourceforge.net/lists/listinfo/wix-users
>> >>>
>> >>
>> >>
>> >
>> -------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Moblin Your Move Developer's
>> > challenge
>> > Build the coolest Linux based applications with Moblin SDK & win great
>> > prizes
>> > Grand prize is a trip for two to an Open Source event anywhere in the
>> > world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> > _______________________________________________
>> > WiX-users mailing list
>> > WiX-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/wix-users
>> >
>> >
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Updating-app.config-tp1077780p1077897.html
>> Sent from the wix-users mailing list archive at Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Updating-app.config-tp1077780p1079584.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to