app-config

.NET Exception Handling Application Configuration File

I apologize as this question is somewhat basic; however, after a great deal of searching, I have not found a suitable answer. I am building a windows forms application and need to reference an app.config file for the location to a data file. Before calling XElement xml = XElement.Load(ConfigurationManager.AppSettings["EntityData"].To...

Where should I put log4net config - App.config or AppName.dll.log4net?

I'm using log4net logging in my DLL class library - I'm wondering where people would recommend I put the log4net configuration - in the App.config or in a separate .log4net config file? ...

Loading C# DLL via reflection, but apply App.config

I am using something like the following to load DLL's in my C# app. foreach (String s in Directory.GetFiles(".", "*.dll")) foreach (Type t in Assembly.LoadFrom(s).GetTypes()) But it does not apply the App.config settings for those binaries. Is there a programatic way to load these settings? ...

Converting programmatic configuration of WCF service to config file

I have written a simple WCF web service which is configured programmaticaly. It exposes three endpoints which bind different bindings to the same contract: WebHttpBinding WebHttpRelayBinding (over Microsoft azure) myBinding (self-made binding in an additional DLL) The configuration code is pretty straight-forward at the moment: WebS...

.NET ConfigurationManager app.config confusion.

I've got an app.config file, which contains the following <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name ="PowershellSnapIns" type ="System.Configuration.DictionarySectionHandler,System"/> </configSections> <PowershellSnapIns> <add key="SnapIn1" value="WebAdministration" /> ...

PowerShell update connection strings

Hi Everyone, I have the following script that will update the connection string across three different config files used in development. function Main() { pushd cd .. $aomsDir = pwd $configFiles = @( 'util\GeneratePocos.exe.config', 'src\Web.UI\web.config', 'src\Data\App.Config') $MyAOMSEntitiesConnStr = $env:AOMS_CONN_STR Write-...

My App.Config file isn't saving anything I modify.

Here's my code: public void VerifyIfFirstTimeRun() { if (System.Configuration.ConfigurationSettings.AppSettings["FirstTimeRunning"] == "true") { //Do bla bla bla //Then do bla bla bla System.Configuration.ConfigurationSettings.AppSettings["FirstTimeRunning"] = "false"; ...

Propagation of .config settings

We have a fairly hefty VS2008 solution that comprises of many library projects that are referenced by one or more other projects. Some of these libraries define things like WCF bindings and connection strings, but when these are referenced by other projects, it seems to become a necessity to copy the binding settings from the library pro...

XmlMassUpdate - Replace Value Node

Hi Guys. I'm trying to use XmlMassUpdate to update my config files based on build Version type. There seems to be no documentation on how to update the new app.config (vs2008) settings formats anywhere. This is the config section: <applicationSettings> <CTC.Mica.ClientService.Properties.Settings> <setting name="PipeName" serializeAs=...

VS2005: separate app.config for debug and release mode

Is there a way to automatically use a separate app.config when building in release mode? In other words, I want to test with one app.config, and release with another. Currently, I keep a separate copy called app.config.production, and manually overwrite bin\Release\Application.exe.config after building for release. ...

Create app.config file dynamically on Application startup

How can I create the app.config file programatically on Application startup (if the file doesnot exist)? ...

Configuration madness, I have an app.Config but my object looks to web.Config

if you have a class library project that acts as ur DAL and it has an App.Config file with connectionstrings, how can I force it to use that config file? It keep getting values from the web.config in my Web Application project. The DAL project uses LinqToSql. When I instansiate a DataContext object in my Web Application, from the refere...

WCF client config: centralized endpoint address

Hi, i've a WCF client wicht refers to multiple services hosted in the same machine. like this example <client> <endpoint address="net.tcp://localhost:8731/TrackingService" binding="netTcpBinding" ... </endpoint> <endpoint address="net.tcp://localhost:8731/CommonService" binding="netTcpBinding"... </endpoint> </client> is ...

Is app.config only used at compile time or is it required at run time as well?

In WCF services and a variety of other .NET apps, I understand that app.config is used to specify settings. Is this file only used at compile time and settings get stored in the assembly or is it required at run time as well? Does it vary per project type? ...

Access App.Config Settings from Class Library Called through Unit Test Project

I have the following setup: ASP.net 3.5 Web Site Project C# Class Library with business logic C# Class Library for unit testing The business logic library does all of the db access. It gets connection strings from the web.config file of the web site by accessing System.Configuration.ConfigurationManager.ConnectionStrings. When the li...

How to use ConfigurationManager for DEBUG dn RELEASE versions in VS 2008 projects

Hi, i would like to use the "ConfigurationManager" settings, that i can create in VS 2008 ( see image ), to create different behaviors in my web.config or app.config files... for example i want to use different connection strings, if the "debug"-configuration is active, like: <configuration> <connectionStrings configSource="connecti...

c# winapp add app.config to installer?

Okay I've got my app.config file that is containing my database settings. All works well on my development machine. But when I install it on a test machine I'm getting a null reference on the following line: ConnectionString = ConfigurationManager.ConnectionStrings["MyDBConn"].ToString(); Why is this happening? I guess that the app.c...

What is a good proxy for me to install and test my Windows Service ?

The deployment requirements for my app (a windows service written in C#) state the presence of a Proxy server. From my interaction with the person who will install my app: 1. His company blocks access to internet via the proxy 2. He needs to provide the path to the proxy script in his IE Config. 3. He also needs to input a user-name/pa...

App.config relative path

Hi, I have folder "Icons". I need to access same inorder to add an icon to imageList. I'm using app.config file in that have a relative path. add key="doc" value="..\Icons_Microsoft Office Excel 97-2003 Worksheet.ico " and I'm using below code to add it to imgList ,however it throws "System.IO.FileNotFoundException". smallImageList.I...

String.Format value in App.config is producing an extra backslash

Here's the line from App.Config: <add key="CheckFileFormatString" value="P{0}\t&quot;{1}, {2}&quot;\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}"/> Here's the code that puts it into a string (please ignore the deprecated .AppSettings.Get call, unless that's the problem): string format = ConfigurationSettings.AppSettings.Get("CheckFileFor...