Question my.settings upgrade to default

Zexor

Well-known member
Joined
Nov 28, 2008
Messages
520
Programming Experience
3-5
i have been using clickonce to update my app. But i dont know why, the settings in my.settings seems to be upgrade from a previous version of the app instead of the last version. Its giving me that same data everytime i upgrade instead of the latest one.
 
This article explains how an upgrade is performed: ClickOnce and Application Settings
That is, non-default user settings are retained.
It also mention you can override Upgrade method to provide custom upgrading. If you don't want to keep user values you can call base Upgrade and then Reset here. Here's an example to partially extend the default MySettings proxy, put it in new class file:
VB.NET:
Namespace My
    Partial Class MySettings
        Public Overrides Sub Upgrade()
            MyBase.Upgrade()           
            MyBase.Reset()
        End Sub
    End Class
End Namespace
 
The thing i dont understand is that the upgrade was working before and the settings were migrating across versions of the program. Then it stopped at one of the version and the settings of that version keep getting copied to future versions. I do want the settings to copy to next version, but i want the latest settings instead of the same old settings over and over.
 
How the upgrade/migration works is explained, so you have to relate to that.
 
ok i found out why my settings data keep reverting to data from version 1. Its because i didnt change the assembly version as i publish new version. Is there a way to increment the assembly version as the publish version increase? Is there an easy way in 2010? i remember something about editing the assemblyinfo file or something before.
 
my publish version is already incrementing but if i dont increment the assembly version as well, the setting will keep restoring to the previous assembly version of the application. ClickOnce app store the user.config file according to the Assembly version.
 
That is not how ClickOnce works when I use it.
 
Back
Top