app-config

How to do hierarchical configuration in .NET's app.config

app.config configuration sections are nice, but I often need multiple configuration sets, but with small difference. what I want is: Have one section with default configuration (this one is created with the designer, and thus has the auto-generated strongly-typed accessors in the Settings class Another section with only the "new" item...

Disabling authenticode signature verification in .NET exe without app.config

Does anyone know how to disable authenticode signature verification in a .NET executable (to avoid slow startup) without using an application config file? In other words, do this: <configuration> <runtime> <generatePublisherEvidence enabled="false"/> </runtime> </configuration> without an app.config. Is it possible? ...

Can a unit test project load the target application's app.config file?

I am unit testing a .NET application (.exe) that uses an app.config file to load configuration properties. The unit test application itself does not have an app.config file. When I try to unit test a method that utilizes any of the configuration properties, they return null. I'm assuming this is because the unit test application is ...

How to use enterprise library logging in a .NET custom action

I have some library code which is used from my application and is also used by a .NET custom action in a Visual Studio installer project. The library code in turn uses the Enterprise Library logging block to do its logging. How can I get configuration information to the Enterprise Library in the context of my custom action running insi...

Assembly binding problems in .NET

I am writing a .NET library that for various reasons cannot be registered in the GAC. This dll (let's call it SDK.dll) depends on other DLLs in order to be loaded. When writing a program that uses this SDK.dll, I noticed that my program failed loading the dll with a FileNotFoundException thrown. This happens because although I was able ...

Built-In methods to backup app.config

Are there any built in methods in System.Configuration that would allow one to backup the currently running apps XXX.exe.config file. Or if not, how would one retrieve the current applications config file name for backup. ...

How do I get intellisense in app.config for a custom section?

We have a custom section in my app.config file related to our IoC container class. How can I get intellisense when editing the config file for this section, as well as getting rid of the compiler messages informing me of the missing schema. I found this question here: app.config configSections custom settings can not find schema informa...

Merge and override .NET configuration files with C#

I wrote this piece of code to merge two .NET configuration files: Add non existent nodes and override values on existing ones. I avoided to use the much faster reader/writer way because the app I'm using it for is not performance critical. What do you think of this? using System; using System.Xml; namespace devcoach.FrameworkExtension...

Can an App.Config be loaded from a string or memory stream?

I know that I can load an app.config file from a different location using the following line of code: AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", ConfigFile); where ConfigFile is a full path location. What I'd like to do though is be able to load a file that has been encrypted for the app.config. Ideally, I'd like to be able to...

Setting SendTimeout in my WCF app.config

Hi, Little confused looking at my app.config, it looks like this: <system.serviceModel> <servcies> <service> <endpoint address="" binding="basicHttpBinding"> <identity> <dns value="localhost" </identity> <endpoint> </service> </services> <behaviors> <serviceBehaviors> ...

Can several WCF services share a common BaseAddress?

I've got an assembly containing several WCF services, each with its own contract. It all works nicely. The service config in the app.config for the service looks like this: <services> <service behaviorConfiguration="WcfService.AlyzaServiceBehavior" name="Sam.Alyza.WcfService.ServiceWebsites"> <endpoint address="" binding="netT...

Is switching app.config at runtime possible?

Is there a way at runtime to switch out an applications app.config (current.config to new.config, file for file). I have a backup/restore process which needs to replace its own application.exe.config file. I have seen this post but it does not answer how to do this at runtime. ...

Changing the .NET application configuration file name.

I have a VB6 app which calls a .NET assembly, which references settings from the app.config file. By default, .NET looks for a config file named after the VB6 app. How can I redirect it to use a different config file name? This needs to become the default config file so that e.g. WCF settings are read from it. ...

.NET 3.5 - Configuration system failed to initialize exception

In my winform app, I am trying to add a userSetting, although the error is occuring with appSettings too. When the setting is added I get an exeption thrown that says: "Configuration system failed to initialize" with a Inner Exception "Unrecognized configuration section userSetting" Exception Details: System.Configuration.Configuration...

WCF minimal app.config settings

What are the minimal settings i need to do for a streamlined WCF config in the app.config? The default one is this: <bindings> <wsHttpBinding> <binding name="WSHttpBinding_IService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" byp...

C# AppSettingsReader: "reread" values into the AppSettingsReader (runtime) ?

In my application, I need to change some value ("Environment") in appSetting of app.config at runtime. I use AppSettingsReader private static AppSettingsReader _settingReader; public static AppSettingsReader SettingReader { get { if (_settingReader == null) { _settin...

Change connection string from class library in main application at run-time

You can change the connection string at run-time like this. You make the connection string setting available for writing as a separate property inside the MySettings class: Partial Friend NotInheritable Class MySettings Public WriteOnly Property RunTimeConnectionString() Set(ByVal value) My.Settings("MyConnectionString") = value ...

Including a generic class in Unity App.Config file

I have a class of type ISimpleCache<IBrokeredDataObject> that I want to add as a type alias (then a type) in the App.Config file the line <typeAlias alias="ISimpleCacheOfIBrokeredDataObject" type="MyApplication.ISimpleCache<IBrokeredDataObject>, MyApplication" /> is obviously wrong due to the <>, however I'm not convinced escaping th...

C# App.Config location

I have a solution with 10 or so projects in it, and have started having issues with SystemConfiguration returning empty configuration instead of locating my App.Config file. Should I have multiple App.Configs, one for each project (I am assuming and hoping not), if not, where is the best place for it to be located in my projects? ...

.NET 1.1 and .NET 2 config files working together

I have inherited a rather large project consisting of an application written in VB6 and several DLL's and ActiveX controls written in VB6, VB.NET 1.1 and VB.NET 2. I want to change one of the settings for one of the DLL's written in VB.NET 2 that is in its application.dll.config file, but it seems to be having no effect. My main VB6 app...