user.config file  
Author Message
twaccess





PostPosted: Thu Aug 11 19:29:19 CDT 2005 Top

Visual C#.Net >> user.config file

Can a user.config file be used in console and desktop apps to override the
app.config settings in a similar way to how a user.config file can override
a web.config? Thanks in advance.

Mark

DotNet367  
 
 
Peter





PostPosted: Thu Aug 11 19:29:19 CDT 2005 Top

Visual C#.Net >> user.config file Sorry to sound dense, but I've never heard of a "user.config" file?
perhaps you could shed some light? If you have an app.config file in your
solution, when compiled, this gets moved to the executable directory and is
automatically renamed by the IDE to
<yourappname>.exe.config
When an .NET executable is run, it looks for a file with this naming
convention automatically, loads and parses it.
The <appSettings> section values (for example) are then all available as a
NameValueCollection in

System.Configuration.ConfigurationSettings.AppSettings["keyName"]... etc.
HTH
Peter



> Can a user.config file be used in console and desktop apps to override the
> app.config settings in a similar way to how a user.config file can
> override a web.config? Thanks in advance.
>
> Mark
>


 
 
Mark





PostPosted: Fri Aug 12 08:44:55 CDT 2005 Top

Visual C#.Net >> user.config file I appreciate the reply. We've been using a user.config file in our web apps
for quite some time using the directions at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/tdlg_ch4.asp.
(Do a text search on the page for "user.config".) The article's language
implies that you can use these user.config files to override all application
configuration files, but I wanted to confirm this was in fact common
practice.

Thanks in advance.

Mark



> Sorry to sound dense, but I've never heard of a "user.config" file?
> perhaps you could shed some light? If you have an app.config file in your
> solution, when compiled, this gets moved to the executable directory and
> is automatically renamed by the IDE to
> <yourappname>.exe.config
> When an .NET executable is run, it looks for a file with this naming
> convention automatically, loads and parses it.
> The <appSettings> section values (for example) are then all available as a
> NameValueCollection in
>
> System.Configuration.ConfigurationSettings.AppSettings["keyName"]... etc.
> HTH
> Peter
>


>> Can a user.config file be used in console and desktop apps to override
>> the app.config settings in a similar way to how a user.config file can
>> override a web.config? Thanks in advance.
>>
>> Mark
>>
>
>