app-config

Application Data Folder and Company Name With Underscores

My VB.NET 2008, .NET 3.5 application is using an app.config with settings defined as User. As expected, it created the folder: C:\Documents and Settings\<user>\Local Settings\Application Data\<company name>\ In this folder are the sub-folders for the application to store the user settings. However, the folder of the company name has u...

Change app.config connection string depending on PC

Hi guys I'm doing a c# course at university, and now I'm beginning linQ to xml, linQ to Sql-Server, etc. I work with the example projects in two PCs (university PC and office PC) Is there an easy way to change connection string (from app.config) at runtime, or designtime (using a constant in main.cs) so I can use a connection string at u...

How do I retrieve AppSettings from the assembly config file?

I would like to retrieve the AppSetting key from the assembly config file called: MyAssembly.dll.config. Here's a sample of the config file: <configuration> <appSettings> <add key="MyKey" value="MyVal"/> </appSettings> </configuration> Here's the code to retrieve it: var myKey = ConfigurationManager.AppSettings["MyKe...

app.config not being renamed when built by an external project?

We are working on a solution with various projects inside of it, the bulk of which is inside our Domain class library. This project contains a app.config file with various settings. The stripped down structure of the solution looks like this: Solution Domain project app.config Integration tests project app.config...

.NET 2.0 app on Windows Server 2003 doesn’t load a .config file

I can’t made my .NET 2.0 applications (and services) to load their appname.exe.config files on Windows Server 2003 Standard Edition SP2, I tried to create manifest like this but it didn’t worked EDIT: Appname.config is located in the same dir, App works without any changes on Windows XP, once we move files or use setup to install i...

Can you override system.serviceModel configuration section?

Hi, We are trying to create a "proxy" class that would serve the WCF service with its configuration properties. Because we can't store those properties in the app.config file, i'm looking for a way to "proxy" it out and use custom configurationSection which would provide all these data upon request. In order to do so, i would need to ...

Can I configure a .NET application to read settings from an SQL database?

I want my app.config (or my web.config for that matter) to read from an SQL database instead of an XML file. How can I do that? ...

AppConfig in a VS 2008 test project?

I've just added my first test project to a VS 2008 solution. I have a component I'd like to use in a unit test; the component calls System.Configuration.ConfigurationSettings.GetConfig() to get a setting, and I'd like for that call to work in my test. Any ideas how I can do this? I don't see any app.config in the project, so I'm not s...

What steps do I need to take to convert from a class library to a WCF?

I created a project as a Class Library. Now I need to make it into a WCF. I can create a WCF project, but I would like to avoid all that fuss with TFS. I've done the App.config and added the /client:"wcfTestClient.exe" line to the Command line arguments. But there seems to be something else missing from it launching the Hosting. ...

Replacing Client section doesn't work (system.serviceModel)

Hi, I'm trying to replace the default machine.config settings for the "client" handler with my own handler, however, when i run it, i'm getting this error: "Section or group name 'client' is already defined. Updates to this may only occure at the configuration level where it is defined." here is how my app.config looks like: <configu...

Sections must only appear once per config file! why???

hi, I'm getting the following exeption: "Sections must only appear once per config file. See the help topic for exceptions. " my configuration file look like this: <configSections> <sectionGroup name="point.System"> <section name="singleInstanceCache" type="xyz.Point.System.Configuration.SingleInstanceCache, Point.System" ...

reading TraceListener initializedata property from config .NET 1.1

I have the following config file: <system.diagnostics> <trace autoflush="true" indentsize="1" > <listeners> <add name="dbgTrace" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\MyLogs\MyApp\Logs\LogFile.log" /> </listeners> </trace> </system.diagnostics> So I can read the traceliste...

Using App.config to set strongly-typed variables

I'm a C# novice running .NET 3.5, and I'd like to store a bunch of application default values in App.config, as the settings may vary by server environment (e.g. development, staging, production). What I want to do is similar to what's described in this StackOverflow article, but I also want to be able to use non-string values (e.g. int...

How to get a List<string> collection of values from app.config in WPF?

The following example fills the ItemsControl with a List of BackupDirectories which I get from code. How can I change this so that I get the same information from the app.config file? XAML: <Window x:Class="TestReadMultipler2343.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas....

String format for Castle DictionaryAdapter

I'm using Castle DictionaryAdapter in order to get the application settings from the app.config as an interface ( based on Getting rid of strings (3): take your app settings to the next level ): public interface ISettings { int MaxUsers { get; } string FeedbackMail { get; } DateTime LastUserLogin { get; } } app.config <?xml ver...

Centralised settings in C# for multiple programs

I was recently given a heap of programs to maintain and I am trying to find some help in adopting some best practices. They are essentially three independant softwares which use a common DLL to manage a series of settings the apps all share. The DLL works this way: it swaps the user settings file (XML file buried deep in the user's confi...

Retrieving applications from app.config during debug

I'm using VS 2008 with .NET 3.5, and I'm having trouble retrieving app settings when debugging. I've added a reference to System.Configuration and the console app compiles and runs, but when I try and retrieve an app setting, the return value is always null. App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configS...

Web Service URL Problem

H!, I have a solution in which there is several other sub projects (windows application). in every project I have some web services added. Now the problem : how can i set the URL of each web service individually from the app.Config file?? is there a setting I missed to set ? can it be automatically done or I have to code for it ? Than...

Add an XML schema to Visual Studio

I want Intellisense support when writing App.config sections or XML configuration files for components like NHibernate, log4net, or Unity. What options do I have to get Visual Studio to find these files and load Intellisense? (Assume we have the schema file.) ...

How to store custom settings for a WCF service?

People says that libraries shouldn't have configuration files. I can't pass arguments to my WCF service class from its host (but I can from the client). I don't want to store the configuration on the client. What should I do? ...