none
How to keep the App.Properties.Settings.Default.Value in the same directory, and it can be referred in latest version? RRS feed

  • Question

  • Dear All,

    Some settings values could be saved to disk and laded by application using App.Properties.Default.Value.

    The problem now I have is, if the version is changed in Properties\AssemblyInfo.cs

    Like below,

    ...

    // You can specify all the values or you can default the Build and Revision Numbers
    // by using the '*' as shown below:
    // [assembly: AssemblyVersion("1.0.*")]
    [assembly: AssemblyVersion("1.5.2.0")]
    [assembly: AssemblyFileVersion("1.5.2.0")]

    The original setting value App.Properties.Default.Value will be changed to another new directory, 

     See below,

    Test.exe_Url_ngyzmkifkzjt012vpyhasngc5euf51hy\1.5.1.0\user.config

    Test.exe_Url_ngyzmkifkzjt012vpyhasngc5euf51hy\1.5.2.0\user.config

    We want the old setting values be kept and they can be reference in latest version,

    Does any one know how to do it?

    Thanks and Best regards,

    E-John


    • Edited by E-John Tuesday, July 17, 2018 5:41 AM
    Tuesday, July 17, 2018 5:40 AM

All replies

  • The documentation for app settings talks about versioning and the steps needed. Basically the assembly version is part of the settings when using the (default) local file settings provider. Each new version gets a new set of settings. If you want to migrate the previous version then you need to call the Upgrade method. This will attempt to bring in the previous settings and then apply them to the newer version.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, July 17, 2018 5:45 PM
    Moderator
  • Hi CoolDadTx,

    Thanks for reply, is there an example to tell us how to do?

    Thanks and Best regards,

    E-John

    Wednesday, July 18, 2018 7:03 AM
  • Take a look at this older post about how to use the settings. It provides information on how the older version should be loaded but I haven't tested the code they gave to verify it works correctly.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, July 18, 2018 1:34 PM
    Moderator