HighTechTalks DotNet Forums  

User Settings

Dotnet Framework microsoft.public.dotnet.framework


Discuss User Settings in the Dotnet Framework forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Steve Barnett
 
Posts: n/a

Default User Settings - 12-13-2007 , 06:48 AM






I added some user settings to my app which caused the Settings.settings to
be generated etc... and all was well and lovely and the Sun was shining.

Then I changed the version number of my assembly (it had been updated, after
all) and all of my settings disappeared, which was somewhat less than lovely
and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves is
assembly version specific. Is there any way to override that so I can retain
the settings across all versions of my app?

Thanks
Steve



Reply With Quote
  #2  
Old   
Steve Barnett
 
Posts: n/a

Default Re: User Settings - 12-18-2007 , 08:14 AM






Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote

Quote:
I added some user settings to my app which caused the Settings.settings to
be generated etc... and all was well and lovely and the Sun was shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves is
assembly version specific. Is there any way to override that so I can
retain the settings across all versions of my app?

Thanks
Steve




Reply With Quote
  #3  
Old   
Peter Duniho
 
Posts: n/a

Default Re: User Settings - 12-18-2007 , 12:44 PM



On Tue, 18 Dec 2007 05:14:50 -0800, Steve Barnett <noname (AT) nodomain (DOT) com>
wrote:

Quote:
Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?
I use it all the time. But I don't have the requirement to preserve the
settings across updates of my programs, so I've never actually had to
solve the problem you're asking about.

I can't speak for everyone else, but just because you haven't received a
response to your question, that doesn't mean no one's using the feature.
At best, it means no one's trying to use it the way you want to use it.

That said, I suspect there _is_ a solution to your problem. I think the
Settings class would be much less useful if users had to start from
scratch every time the program was updated. I just don't happen to know
what that solution is. Sorry...

Pete


Reply With Quote
  #4  
Old   
Kevin Spencer
 
Posts: n/a

Default Re: User Settings - 12-19-2007 , 07:32 AM



Hi Steve,

I use User Setting quite often, but have never tried to deal with the issue
of persisting settings across versions of the application. I suspect that
the best way to do this would be to use the System Registry for such
settings, as it is in a well-known location that will not change, and will
persist the settings as long as either your application or the user removes
them.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote

Quote:
Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings to
be generated etc... and all was well and lovely and the Sun was shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves is
assembly version specific. Is there any way to override that so I can
retain the settings across all versions of my app?

Thanks
Steve






Reply With Quote
  #5  
Old   
Steve Barnett
 
Posts: n/a

Default Re: User Settings - 12-19-2007 , 12:11 PM



My concern over using the registry or well know locations was with Vista
security. I was unsure as to what it may or may not limit me to. Similarly,
what about security policies that system administrators put in place. The
user settings seemed to be a safe (Microsoft) way round this.

What I've done for now is throw together my own class to wrap "ini" file
functionality using an xml file. It allows me to control where the file goes
and what it's called and I don't need to worry about application version
numbers. I've used a "well known location" and am just hoping it won't get
locked down by Vista. (It's the users Application Data folder - since, on
reflection, I'm saving application data - folder locations - rather than
pure user data.).

I sacrifice strong typing using this method, but you can't have everything.

Thanks
Steve



"Kevin Spencer" <unclechutney (AT) nothinks (DOT) com> wrote

Quote:
Hi Steve,

I use User Setting quite often, but have never tried to deal with the
issue of persisting settings across versions of the application. I suspect
that the best way to do this would be to use the System Registry for such
settings, as it is in a well-known location that will not change, and will
persist the settings as long as either your application or the user
removes them.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:epqM6fXQIHA.2376 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings
to be generated etc... and all was well and lovely and the Sun was
shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves
is assembly version specific. Is there any way to override that so I can
retain the settings across all versions of my app?

Thanks
Steve








Reply With Quote
  #6  
Old   
Kevin Spencer
 
Posts: n/a

Default Re: User Settings - 12-20-2007 , 07:14 AM



Hi Steve,

Considering your decision regarding approach, you could still use User
Settings. All you would have to do is to copy the existing User Settings to
your installation Settings file. It is, after all, just an XML file
containing a serialized class.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote

Quote:
My concern over using the registry or well know locations was with Vista
security. I was unsure as to what it may or may not limit me to.
Similarly, what about security policies that system administrators put in
place. The user settings seemed to be a safe (Microsoft) way round this.

What I've done for now is throw together my own class to wrap "ini" file
functionality using an xml file. It allows me to control where the file
goes and what it's called and I don't need to worry about application
version numbers. I've used a "well known location" and am just hoping it
won't get locked down by Vista. (It's the users Application Data folder -
since, on reflection, I'm saving application data - folder locations -
rather than pure user data.).

I sacrifice strong typing using this method, but you can't have
everything.

Thanks
Steve



"Kevin Spencer" <unclechutney (AT) nothinks (DOT) com> wrote in message
news:uRdfzsjQIHA.4740 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Hi Steve,

I use User Setting quite often, but have never tried to deal with the
issue of persisting settings across versions of the application. I
suspect that the best way to do this would be to use the System Registry
for such settings, as it is in a well-known location that will not
change, and will persist the settings as long as either your application
or the user removes them.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:epqM6fXQIHA.2376 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Is it that no one uses the generated Settings class and user.config
file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings
to be generated etc... and all was well and lovely and the Sun was
shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves
is assembly version specific. Is there any way to override that so I
can retain the settings across all versions of my app?

Thanks
Steve










Reply With Quote
  #7  
Old   
RobinS
 
Posts: n/a

Default Re: User Settings - 12-24-2007 , 04:06 PM



We rolled our own configuration manager in order to sustain the settings
when we do updates.

We are using ClickOnce deployment, so the config file is not part of the
installation, it is created by the application when you run it (if it
doesn't exist), and updated thereafter.

We are outputting ours as XML, putting it in the user's profile folders down
under LocalSettings, where we create a folder for our application's files.

Hope that helps.
RobinS.
GoldMail, Inc.
-------------------------------------------

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote

Quote:
Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings to
be generated etc... and all was well and lovely and the Sun was shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves is
assembly version specific. Is there any way to override that so I can
retain the settings across all versions of my app?

Thanks
Steve





Reply With Quote
  #8  
Old   
Sid Price
 
Posts: n/a

Default Re: User Settings - 12-25-2007 , 03:39 PM



I am sure the procedure is the same for C#, or at least similar:
'

' Check if the settings need migrating from previous version

'

If My.Settings.Current = False Then

My.Settings.Upgrade()

My.Settings.Current = True ' Done the upgrade

End If

Sid.


"RobinS" <robins (AT) imnottelling (DOT) com> wrote

Quote:
We rolled our own configuration manager in order to sustain the settings
when we do updates.

We are using ClickOnce deployment, so the config file is not part of the
installation, it is created by the application when you run it (if it
doesn't exist), and updated thereafter.

We are outputting ours as XML, putting it in the user's profile folders
down under LocalSettings, where we create a folder for our application's
files.

Hope that helps.
RobinS.
GoldMail, Inc.
-------------------------------------------

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:epqM6fXQIHA.2376 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Is it that no one uses the generated Settings class and user.config file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings
to be generated etc... and all was well and lovely and the Sun was
shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves
is assembly version specific. Is there any way to override that so I can
retain the settings across all versions of my app?

Thanks
Steve







Reply With Quote
  #9  
Old   
RobinS
 
Posts: n/a

Default Re: User Settings - 01-03-2008 , 08:26 PM



Yes, I've seen that in VB. I don't know if C# has a corresponding, uh,
"opportunity". It could be true.

However, now what if your user wants to revert back a version, or if he
uninstalls and reinstalls the application?

For us, it gave us more functionality and flexibility to write out own
config manager. It's not that much code; we used a dictionary to store the
data in memory; we read it in when starting the app, write it out when
anything gets updated.

Good luck to all.

RobinS.
GoldMail, Inc.
---------------------------------

"Sid Price" <sid (AT) nowhere (DOT) com> wrote

Quote:
I am sure the procedure is the same for C#, or at least similar:
'

' Check if the settings need migrating from previous version

'

If My.Settings.Current = False Then

My.Settings.Upgrade()

My.Settings.Current = True ' Done the upgrade

End If

Sid.


"RobinS" <robins (AT) imnottelling (DOT) com> wrote in message
news:MfCdnUQ22vTBgu3anZ2dnUVZ_rWtnZ2d (AT) comcast (DOT) com...
We rolled our own configuration manager in order to sustain the settings
when we do updates.

We are using ClickOnce deployment, so the config file is not part of the
installation, it is created by the application when you run it (if it
doesn't exist), and updated thereafter.

We are outputting ours as XML, putting it in the user's profile folders
down under LocalSettings, where we create a folder for our application's
files.

Hope that helps.
RobinS.
GoldMail, Inc.
-------------------------------------------

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:epqM6fXQIHA.2376 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
Is it that no one uses the generated Settings class and user.config
file?

Perhaps I'm wasting my time with this feature?

Anyone have an opinion?

Steve

"Steve Barnett" <noname (AT) nodomain (DOT) com> wrote in message
news:ecZXg4XPIHA.4880 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
I added some user settings to my app which caused the Settings.settings
to be generated etc... and all was well and lovely and the Sun was
shining.

Then I changed the version number of my assembly (it had been updated,
after all) and all of my settings disappeared, which was somewhat less
than lovely and the clouds came rolling in.

I gather the user.config file that the Properties.Settings class saves
is assembly version specific. Is there any way to override that so I
can retain the settings across all versions of my app?

Thanks
Steve








Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.