-
Dec 5th, 2022, 09:45 AM
#1
Thread Starter
Fanatic Member
[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:
If Not Settings.IsUpgraded Then
Settings.Upgrade()
Settings.IsUpgraded = True
Settings.Save()
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.
-
Dec 5th, 2022, 10:10 AM
#2
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
-
Dec 5th, 2022, 10:16 AM
#3
Thread Starter
Fanatic Member
Re: My.Settings Upgrades
 Originally Posted by techgnome
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.
-
Dec 5th, 2022, 01:48 PM
#4
Re: My.Settings Upgrades
 Originally Posted by clarkgriswald
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
-
Dec 6th, 2022, 09:29 AM
#5
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|