is My.Settings version specific?

G

Graham Charles

Since the .config file that contains the values in My.Settings is saved
to...

%USERPROFILE%\Local Settings\Application
Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison>

....that implies that if I update the AssemblyVersionAttribute (make a
new build, say), my users' configuration files will no longer be valid.
Does that sound right? Seems like an odd default behavior. I suppose I
could manually copy the .config file during the upgrade installation,
but... well, it just seems silly.

Also, in a related question, the <companyname> in the above path seems
to have spaces replaced with underscores. Is that a documented
behavior, too? I can't find it in the SDK.

Thanks,

g.
 
H

Herfried K. Wagner [MVP]

Graham Charles said:
Since the .config file that contains the values in My.Settings is saved
to...

%USERPROFILE%\Local Settings\Application
Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison>

...that implies that if I update the AssemblyVersionAttribute (make a
new build, say), my users' configuration files will no longer be valid.
Does that sound right? Seems like an odd default behavior. I suppose I
could manually copy the .config file during the upgrade installation,
but... well, it just seems silly.


You may want to check out the 'My.Settings.Upgrade' method.
 
G

Graham Charles

Thanks for that. Is there a way to test if the application is being run
for the first time since an upgrade? IsFirstRun (in
....ApplicationDeployment) seems to pertain to ClickOnce apps only. For
now, I've created a new user-scoped setting "HasRun" with a default
value of False, and am setting it to true in my Main code:

If Not My.Settings.HasRun Then
My.Settings.Upgrade() ' / retrieve current settings
My.Settings.HasRun = True
End If

Does that look like a best practice?

Thanks again,

g.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top