Results 1 to 4 of 4

Thread: Get data form existing user.config file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 2023
    Location
    Hoornaar, NL
    Posts
    30

    Get data form existing user.config file

    Hi all,

    I have build an application/tool and there are some settings which can be changed. Saving to the user.config file works like a charm.
    But...
    When updating the application, a new folder in AppData\Local\<APP NAME> gets a new folder with a kind of hash in its name. And in that new folder a new user.config file is created. The settings in the new application should use the "old" folder so the user doesn't need to adjust the settings everytime I update the application.
    How can I achieve that? I thought a "simple"
    Code:
    My.Settings.Upgrade()
    would do the tric but apparently I must to more.

    Thank you!

    Paul

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,994

    Re: Get data form existing user.config file

    Thread moved from VB.NET to Application Deployemt.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,994

    Re: Get data form existing user.config file

    What .NET version are you targeting? It may not make a difference but I want to test using the same version. I've never done this myself but it's my understanding that a call to Upgrade should do the trick but that you don't even need to call it yourself. If you add an Application-scoped setting named UpgradeRequired and set that to True each time you deploy a new version, I have read that that should trigger Upgrade to be called automatically. If you don't want to do that for some reason, please show us the actual context in which you're calling Upgrade.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Dec 2023
    Location
    Hoornaar, NL
    Posts
    30

    Re: Get data form existing user.config file

    Target .NET version is 8.0.

    Is the UpdateRequired something like this?

    Code:
    If Not Settings.IsUpgraded Then
         Settings.Upgrade()
         Settings.IsUpgraded = True
         Settings.Save()
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width