app-config

C#: manage Multiple App.config files

I am facing a problem. I have a dll which is interacting with a webservice and it saves its endpoint configuration in its app.config file. I want to use this dll from my host application. The host application has its own config file. I have to merge the contents of dll's config to host's config each time when I change service endpoint....

Why does ConfigurationManager.OpenMappedExeConfiguration have an extra connection string not in the file?

I'm unit testing my config file for a win forms application. In the LocalTestRun.testrunconfig I set it to copy the app.config. I've checked the Environment.CurrentDirectory while the test was running and the file doesn't have this extra connection string either. This is the test method: [TestMethod] public void Configuration_Connec...

Contextual Information in app.config files

Is there an list of Contextual Information (ie ${longdate}, ${level}, ${message}) online? I want to set the log file in a folder the user's AppData\Local. Is it maybe ${appdatalocal}? And how would I access the file to send as an email attachment maybe like message.Attachments.Add("${appdatalocal}\somefolder\Application.log")? ...

Set roaming setting at runtime

Hi gurus In .net, is possible, at run-time, to specify if a user configuration setting should roam or not? Or is it possible to set this setting in the app.config file? ...

app.config "forced" (?) on .net 4.0.. is it needed?

It seems that when upgrading a project to .net 4.0 in VS 2010 Beta 2, a app.config file is generated, which roughly looks like this: <?xml version="1.0"?> <configuration> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration> Is this file needed in case I want to have a .NET 4.0 only exe...

Need an app config file opinion here.....

I know that app config is used to provide environmental type of values for process variables. And it is very much key/value oriented. But I have a process (windows service) that uses a skeleton xml template file to produce a fuller version of that file after processesing. What about the idea of including that 'skeleton xml' in the app ...

How do you wrap and access the config files from your applications?

Well, the question speaks for itself. I use to have a static Config class in my project that lazy-load the data from the config file like this : private static string _foo; public static string Foo { get { if (string.IsNullOrEmpty(_foo)) _foo = ConfigurationManager.AppSettings["fo...

How can i tell SubSonic 2 to use a different .config file?

I'm using SubSonic 2 from within a project and I'd like to specify a different .config file from the default App.config. How can I tell SubSonic to use a specific config file? ...

Error "A namespace does not directly contain members such as fields or methods"

I'm trying to build my C# project and I'm getting the error message "A namespace does not directly contain members such as fields or methods". It is flagging the first character (the less than symbol) of the app.config file. I've checked all of my files for places where there are variables or functions directly inside of a namespace--f...

How to access app.config/web.config for the current Application?

Although in name this question is similar to this and this, it's not. I'm currently developing a library that may require some custom configuration depending on the user's desire. I have created a custom configuration section, and everything works just fine. However, when I was debugging I noticed that the configuration section const...

Screen saver application doesn't read App.Config

Hi, I've written a screen saver in C# but whenever I run it on preview mode or let it kick in, it throws an exception. When I double click it in Windows\System32 it runs fine. With the Visual studio debugger I sussed out that it doesn't read the .config file of the application, which is also in Windows\System32. I think that when rundl...

How do I retrieve ApplicationSettings from a loaded app.config file

Is it possible to access the values from the applicationSettings section of a loaded app.config file? I have found an example How do I retrieve appSettings, but i can't find out how to access applicationSettings this way. ...

Modifying config sections in App.config either at runtime or install time.

I have an WinForms application that is deployed using Visual Studio 2008's publish (ClickOnce) system. Within the application's app.config file I have a config section that is required by a third party component that has the form: <section name="thirdPartySection" type="System.Configuration.NameValueSectionHandler" /> The section is t...

Nested ConfigurationElementCollection

I have a following configSection in App.Config. http://codepaste.net/vrhrht This has been mapped to following Classes in c# http://codepaste.net/nzdfdy I am getting the following error Unhandled Exception: System.Configuration.ConfigurationErrorsException: Unrecogn ized element 'services'. Can anybody let me know what is wrong her...

Configuration System Designer tool for Visual Studio 2005

Is there Configuration Section Designer like http://csd.codeplex.com/ for Visual Studio 2005? ...

Enabling jitDebugging for WinForms

Hi, I am trying to enable JIT debugging for my winform application, I want to use Dr Watson to dump the stack trace, but when the exception is happening on my App I get a .NET dialog box (Continue or Quit), the details in this box say that I have to change some values in the machine.config or in the app.config of this application will i...

VS2010 Beta 2 Won't Continue Past Exception

I'm debugging a WinForms client that calls a WCF service in VS2010 Beta 2. I want to test my exception handling code, so I intentionally mis-configured my endpoint in app.config. The expected ConfigurationErrorsException is thrown. However, VS2010 stops on the offending line of code even though I have set it not to break for either Th...

When is an app.config created, when an app.exe.config and what is the difference

We have created a WinForms application and store some configurations via the ConfigurationManager class. In order to store the information I use Configuration pConfig = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); pConfig.AppSettings.Settings.Add("updates", szUpdatesURL); pConfig.Save(ConfigurationSaveMode.Mo...

WCF Setting in code vs app.config

If I set a setting in the app.config and in code which one will get used? Example: Dim instance As ServiceThrottlingBehavior Dim value As Integer value = instance.MaxConcurrentInstances instance.MaxConcurrentInstances = value VS <configuration> <system.serviceModel> <services> <behaviors> <serviceBehaviors> ...

Is it possible to "inject" a .NET dll into another .NET application, by way of app.config perhaps?

I have made a .NET class library in C# that initializes some logging, sent to an external tool. The library is altogether separate from any application, but in order to initialize it, I need to make at least one method call to it. Is there a way for me to put something into app.config that will auto-load that dll, and call something in ...