Home All Groups Group Topic Archive Search About

is My.Settings version specific?

Author
11 Aug 2006 7:30 AM
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.

Author
11 Aug 2006 2:38 PM
Herfried K. Wagner [MVP]
"Graham Charles" <gra***@aiid.com> schrieb:
> 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.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
11 Aug 2006 8:37 PM
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.


Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "Graham Charles" <gra***@aiid.com> schrieb:
> > 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.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>