app-config

A Visual Studio 2008 automated tests project can read a configuration file like app.config? (C# .NET)

I have an app.config file inside my TestProject, but when I try to read it using ConfigurationManager it reads from somewhere else and it's none of my app.config's. How to correct this? Current config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="Production" connectionString="Server=127.0...

Pros and cons of appSettings vs applicationSettings (.NET app.config)

When developing a .NET Windows Forms Application we have the choice between those App.config tags to store our configuration values. Which one is better? <configuration> <!-- Choice 1 --> <appSettings> <add key="RequestTimeoutInMilliseconds" value="10000"/> </appSettings> <!-- Choice 2 --> <configSections> <sectionGr...

Combining multiple config files in Visual Studio

I have a solution in Visual Studio 2008 which contains multiple C# projects. Each project has it's own config file (App.config and Settings.settings). This makes sense architecturally as each module is autonomous and is used in a number of different solutions. My problem is that when I compile the solution only the config file for the s...

Specifying connection string in config file for a class library and re-use/modify in ASP.NET Web Application

How can one specify the connection string in a config file of a class library and later modify this when used in a ASP.NET Web Application? The Class library is a data access layer that has a Dataset connecting to a database based on a connection string specified in a config file (Settings.settings/app.config). This class library is us...

How do you restart an app/reread app.config file when modified (.NET)?

We all know that modifying a .NET web application's web.config file restarts the app and makes it read the updated configuration. How do you do that with a console or WinForms app? Thanks :) ...

How to edit application configuration settings? App.config best way to go?

For my project I have settings that I added through the Settings in the project properties. I quickly discovered that editing the app.config file directly seems to no really update the settings value. Seems I have to view the project properties when I make a change and then recompile. I'm wondering ... what is the best and easies...

Use XML includes or config references in app.config to include other config files' settings

I have standard logging, nhibernate, etc configuration blocks in my app.config and I'd like to extract them into a common xml file that can be included as a reference by all of my applications' app.config files. Is this possible? ...

WCF Configuration - Split it out of app.config

Hi all, I have a specific requirement to remove all client WCF configuration (<system.serviceModel>) out of the main app.config file, and into a separate XML file. The behaviour I would like to see is similar to that available in the appSettings section using the File="" directive. In fact, I'd ideally like to be able to specify a s...

How to avoid duplicate settings when using 2 projects and 2 testing projects in Visual Studio?

Following my previous question, now I have 2 projects: one Console Project and a Library Project. They also have their respective unit test projects. When I run a test for the console project that uses a method from the library project and the library project needs an app.config setting, that setting must be in the console test project's...

MSTest.exe not finding app.config

I'm currently trying to run MSTest.exe from NCover, but I believe the question could apply generally to running MSTest.exe from the command line. If I have the "/noisolation" argument, then MSTest.exe appears to find and use the app.config as expected. Without it, NCover doesn't capture any coverage information. From my research so fa...

Is there any way for an App.config file to reference another full config file? (.NET)

Update: this question, including the title, was rephrased, see history for details I know that the following App.config includes a external file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings configSource="appSettings.config"/> <system.net> <connectionManagement> <add address="*" maxconnection="50...

Distributing applications where the configuration settings are encrypted using Entrerprise library

Hi All, I have a thought about this but could not come with a good solution. I have a windows application. I use enterprise library (3.1) Data Access Application Block. Now I use the DataProtectionConfigurationProvider to encrypt the connection strings. This application has to be deployed across multiple machines. I don't want the end...

How to set up a WCF client using wsDualHttpBinding in code?

I have a need to connect to a WCF service I wrote without having to deploy an app.config for the client application I'm writing. However, I've been having a very difficult time trying to figure out how to set up things from the client side in code. This is as far as I've gotten... does anyone have any ideas what I need to do to get this ...

Development vs Production: Connection Strings

I'm in the process of moving SQL server to a separate machine. Currently we are running our web server and sql server on the same box. So we have a production server with IIS and SQLServer and then a separate development server that mirrors this setup. When it comes to our asp.net control's app.config and web site's web.config, this h...

Two test projects in one solution app.config problem (Visual Studio 2008 Professional)

I have 2 projects each one with its own unit test project, and one app.config for each project+test project pair. The tests do not fail if I run only one each time. But if use "Run all tests in solution" all tests will use just one of the app.config's, and it will be the wrong one for all tests in one of these test projects. How do I ru...

How should I store public settings? (.NET)

I'm using the application-scoped settings to store settings that cannot change at run-time. I'm using the user-scoped settings to let individual users configure their preferences. But how should I store/control settings that are modifiable at run-time by an admin-level user that are application wide (i.e., they impact all of the PC's u...

Making all Apps on a Server Use SQL Session Manager

Is there any way to make all the applications on a server use SQL Server as the session manager? The reason is that we have a server with hundreds of applications and we want to start load balancing the server but it will be a big hassle to configure each individual application to use SQL Server as the session manager. It will also p...

Including a service reference from a class library

I have a C# class library and a startup project (a console app). The class library includes a service reference to a web service. When I try to run the project, I get an InvalidOperationException because the startup project isn't reading the class library's app.config, and it's ignoring the service reference. To get it working, I'm force...

.NET own configuration file

Is there any way that I could specify at runtime the configuration file I would like to use (other than App.config)? For example I would like to read a first argument from a command line that will be a path to the application's config and I would like my application to refer to it when I use ConfigurationManager.AppSettings (It's probabl...

How to read strongly typed objects from an app.config file manually

I have a dll that I want to read from a manually specified app.config file (the dll is an .net extension to a native com dll that is a Microsoft Management Console snap in, so there is no mmc.exe.config). I have been able to open the config file, read the relevant group and section to get the setting that I want. Like this: ExeConfig...