Results 1 to 5 of 5

Thread: [RESOLVED] My.Settings Upgrades

  1. #1

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    751

    Resolved [RESOLVED] My.Settings Upgrades

    I have a small internal tool that I have created for a few employees at my office. I didn't bother creating an install for the application since it is so small, I just post the app folder on the network named by the version (e.g. .../1.0.0.0/all app files). If they have never installed the application before, they manually copy the directory locally and run from there. When I create a new version of the app and post it to the network, the code will check if there is a later version on the network and automatically copy the directory to their local system in a folder named by the version (e.g. .../2.0.0.0/all app files).

    My question is, I want their My.Settings to persist with exception to any new User settings I add or Application settings I change. I thought the My.Settings.Upgrade approach would handle this, but that does not seem to be the case (likely due to my distribution method).

    vb.net Code:
    1. If Not Settings.IsUpgraded Then
    2.      Settings.Upgrade()
    3.      Settings.IsUpgraded = True
    4.      Settings.Save()
    5. End If

    I did notice that v1 settings are installed to this folder:
    SupportTool.ex_Url_uopgrc3aeemmlz1wpkxh4uauztdhfkww/1.0.0.0/user.config

    v2 settings are in here:
    SupportTool.ex_Url_wup2n2r1tool0z11i2wrkukvukln3r11/2.0.0.0/user.config

    So the hashes are different, but not sure that matters.

    Any help here?
    Last edited by clarkgriswald; Dec 5th, 2022 at 10:21 AM.

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,065

    Re: My.Settings Upgrades

    If you're looking for new User settings to migrate into their User.Settings file ... it only gets copied over if the value is changed from the default. Otherwise the value remains in the application.settings file, which is what defines the default value.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    751

    Re: My.Settings Upgrades

    Quote Originally Posted by techgnome View Post
    If you're looking for new User settings to migrate into their User.Settings file ... it only gets copied over if the value is changed from the default. Otherwise the value remains in the application.settings file, which is what defines the default value.

    -tg
    Which would be perfect, but it doesn't seem to be doing that. For example, I have a string setting LastUser. After running v1.0.0.0 the setting is updated appropriately, say 'foo' and it is in the user.config as expected. However, when v2.0.0.0 is run, the Upgrade call IS made as expected, but the LastUser is still empty after the call. The only setting in the new file is the IsUpgraded flag that now has a value of True.

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,065

    Re: My.Settings Upgrades

    Quote Originally Posted by clarkgriswald View Post

    I did notice that v1 settings are installed to this folder:
    SupportTool.ex_Url_uopgrc3aeemmlz1wpkxh4uauztdhfkww/1.0.0.0/user.config

    v2 settings are in here:
    SupportTool.ex_Url_wup2n2r1tool0z11i2wrkukvukln3r11/2.0.0.0/user.config

    So the hashes are different, but not sure that matters.

    Any help here?
    If htis was here earlier (I see you edited the post) I missed it ... but yes the location matters. Unless the file is copied from v1 to v2, what ends up in v2 will be a new/empty file.

    That said ... .Upgrade should work... but I suspect it isn't because V2 doesn't know about V1 bacause you're using a copy to install method, than an actual install process. That said, maybe as part of that copying, you need to also grab the current uer.config file and copy it ot the new directory.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Fanatic Member clarkgriswald's Avatar
    Join Date
    Feb 2000
    Location
    USA
    Posts
    751

    Re: My.Settings Upgrades

    I changed the way this worked and ensured that the application was installed into the same folder.

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