My.Settings.Upgrade doesn't upgrade?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Altman

    My.Settings.Upgrade doesn't upgrade?

    Hi all,

    In my VB 2005 project I create a setting called UpgradeRequired with a
    default value of True, and I include the following code that runs when the
    project is launched:

    If My.Settings.Upg radeRequired Then
    My.Settings.Upg rade()
    My.Settings.Upg radeRequired = False
    My.Settings.Sav e()
    End If

    This code should allow a user to run one version of my app which saves
    settings, then run a newer version of the app and automatically have the
    saved settings applied to the newer version of the app. But (as you guessed
    by the fact that I'm posting this question) it's not working. When I run
    the newer version of my app I just get the default values for all of the
    settings.

    To try to get to the bottom of this, I need to understand what magic
    My.Settings.Upg rade uses to determine if there was a previous version of the
    app settings. I notice that the persistence mechanism creates a user.config
    file in a new application folder for each new version of my app:

    My Profile
    Application Data
    My Company
    MyApplication.e xe_Url_abcdefg
    1.0.0.0
    MyApplication.e xe_Url_hijklmn
    1.1.0.0

    However, when I create simple test program that does the same thing, and
    just change the file and assembly version numbers between runs, it puts both
    "version" folders under the same application folder:

    My Profile
    Application Data
    My Company
    MyApplication.e xe_Url_gibberis h
    1.0.0.0
    1.1.0.0

    So, something that I am doing when I build and install my application in a
    production environment is causing the My.Settings magic to think that what
    newer versions of my application are a totally different application.

    My application consists of a main program and a bunch of strong name signed
    DLLs, all of which share the same assembly and file version strings. Each
    time I create a new version of my application I create a new, higher version
    number and rebuild the whole kit and caboodle with that new version number
    baked into all of the assemblies.

    One other thing I'm doing is this: Each of the DLLs has its own user-scoped
    settings (maintained in the magic My Project -Settings designer). This
    seems to work as expected; each assembly "sees" its own settings via
    My.Settings.<Se ttingName>, and all of the settings are persisted in separate
    sections of the user.config file.

    TIA - Bob


  • Bob Altman

    #2
    Re: My.Settings.Upg rade doesn't upgrade?

    It turns out that there is one more crucial point that I didn't think of:
    Each new release of my app is installed into a different folder! (We have a
    requirement to be able to have multiple versions of the app installed
    side-by-side.) So, the My.Settings magic probably considers each new
    release a different app because it comes from a different location.

    That leaves me with the question of how to tell My.Settings that it should
    consider any version of my app to be the same app even if its location has
    changed. Is that possible?

    TIA - Bob

    Comment

    • Bob Altman

      #3
      Re: My.Settings.Upg rade doesn't upgrade?

      Thanks Hongye, signing my application solved my problem!

      Bob


      Comment

      • Hongye Sun [MSFT]

        #4
        Re: My.Settings.Upg rade doesn't upgrade?

        You are welcome, Bob. I am glad that my suggestion helps you.

        Have a nice day.

        Regards,
        Hongye Sun (hongyes@online .microsoft.com, remove 'online.')
        Microsoft Online Community Support

        Delighting our customers is our #1 priority. We welcome your comments and
        suggestions about how we can improve the support we provide to you. Please
        feel free to let my manager know what you think of the level of service
        provided. You can send feedback directly to my manager at:
        msdnmg@microsof t.com.
         

        This posting is provided "AS IS" with no warranties, and confers no rights.

        Comment

        Working...