app-config

Visual Studio & SubVersion : What about Machine Specific Files

As an example we have a Unit Test Project with an app.config file. The app.config file is configured to work on our build server. But if we want to run our tests locally (with local database) we have to change the app.config...everytime... is there a way to never alter the app.config but to have another file that overrides the app.config...

Configuring conditional compilation symbol in app.config file

Can we configure conditional compilation symbol in app.config file? If it is possible then let us know how to do it. Thanks, P. Gopalakrishnan ...

Is it possible to modify configuration ConnectionStrings at runtime?

Is it possible to modify the connectionstrings defined in the app.config/web.config at runtime? I want to use different configfiles depending on the machine the app/site is run on (only for debugging purposes, of course. We'll use the regular config files when deployed). I can write AppSettings, but not ConnectionStrings (AFAIK). Or can...

Multiple config files: Which one do the process read from?

Hi, I have a solution with multiple projects. In each project I've added a .config file with settings that affect the local settings. When I tried to read the settings for the database connection, I got some values which I don't know where they come from. This is the .config file of DatabaseLayer Solution: <configuration> <configSect...

.NET Type loadable from App.Config

How do I design a type that loads it's properties from the App.Config file in the same way that SMTPClient class, or a TraceListener would? What standards should I follow when doing this? ...

Dynamic Connection Strings for Strongly Typed DataSet in a Class Library using App.Config

This is my first question on StackOverflow.com and I'm not sure if this is the correct way to do this. I found a similar question titled: Modifying the Data Source for the Strongly Typed Dataset Connection String. However, the answer provided is not working for me. I'm not able to comment on it because I don't have enough "reputation poi...

Translate this app.config xml to code? (WCF)

I have the following app.config section that I need to translate into code. I have seen several examples, but still cannot quite get it to work. Could anyone help? <system.serviceModel> <bindings> <basicHttpBinding> <binding name="MyService" closeTimeout="00:01:00" openTimeout="00:01:...

How to store a collection of custom objects to an user.config file?

I would like to store a collection of custom objects in a user.config file and would like to add and remove items from the collection programmatically and then save the modified list back to the configuration file. My items are of the following simple form: class UserInfo { public string FirstName { get; set; } public string La...

.NET Configuration Section Designer - Where is my collection?

I am using the Configuration Section Designer for .NET to build a simple ConfigurationElementCollection. It appears that everything builds just fine and the code is automatically generated since the sub-elements are visible with Intellisense. Unfortunately, even though I have added elements to the collection in the configuration sectio...

Enabling Intellisense for Custom Sections in .config Files

When editing .NET config files (app.config, web.config, etc) in Visual Studio, I get Visual Studio's intellisense to guide me when choosing my application's settings. If I add a custom configuration section, how can I enable intellisense for my custom settings? I'm sure there must be an easy answer to this, but a cursory Google search di...

configuring file for DLLs

We are having application which load our custom DLLs (these DLLs are implementing some interface) on runtime from the root of the application and execute a method through reflection. If custom DLL have to read some value from config files then we have to copy these config settings into app.config file of the main application. Is there ...

The external modification/updation in app.config, web.config would be applicable at run-time?

Hey, Here is a doubt. The external modification/updation in application configuration files for .net - app.config, web.config - would be applicable at run-time? Or the application need to be restarted.? Is this applicable for the sections in these config files? thanks 123Developer ...

How do I configure base class libraries in my app.config file?

I've found a couple of snippets of information pertaining to app.config/web.config that hints at almost codeless configuration of BCL components directly through the app.config. However, given the amount of tags suggested by the intellisense within the app.config, it suggests that there is a huge amount of possibilities for this that I ...

Why are application settings read only in app.config?

I have some settings in my app.config which I intend to be 'global' - ie. any user can change them, and all users get the same setting. But unless I change them to be user settings, they are read only. Why is this? And how should I go about persisting my app's global settings? Edit: This is actually a windows service application whi...

Custom app.config Config Section Handler

What is the correct way to pick up the list of "pages" via a class that inherits from System.Configuration.Section if I used a app.config like this? <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="XrbSettings" type="Xrb.UI.XrbSettings,Xrb.UI" /> </configSections> <XrbSettings> <pag...

What's the most appropriate exception to throw if a required app/web.config configuration setting is not present?

(Asked by @tomhollander on Twitter) What's the most appropriate exception to throw if a required app/web.config configuration setting is not present? ...

How do I specify the name of my application's App.config file in WPF?

This is very frustrating... I can set the Configuration File for a Windows Forms Application just fine. Consider this: public static void Main(){ AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", @"SharedAppConfig.config"); //do other things } However, in a WPF application, this doesn't seem to work! If I set this value, the ...

How to find path of active app.config file?

I'm trying to finish this exception handler: if (ConfigurationManager.ConnectionStrings["ConnectionString"]==null) { string pathOfActiveConfigFile = ...? throw new ConfigurationErrorsException( "You either forgot to set the connection string, or " + "you're using a unit test framework that looks for "+ "the...

Assembly Redirection not working as expected

I am trying to introduce Strong Signing in my project assemblies. My project output is persisted in XML and a type is mentioned (before signing) as: typestr="XYZ.PQR, MyWidget, Version=1.0.2406.20198, Culture=neutral, PublicKeyToken=null" After all the assemblies are signed with public-key with token, 622edca63ee1770c. I have introd...

Add multiple sections to App.Config

Hi All, I need to add a section to my app.config programmatically. currently i use the Configuration editor where in there is seperate project which contains a class file with al configsection attributes set .I then use the configuration editor access this dll created and add a section .Now i want to access this same ConfigurationClass f...