How to: Add an application configuration file to a C# project

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

By adding an application configuration file (app.config file) to a C# project, you can customize how the common language runtime locates and loads assembly files. For more information about application configuration files, see How the runtime locates assemblies (.NET Framework).

Note

UWP apps don't contain an app.config file.

When you build your project, the development environment automatically copies your app.config file, changes the file name of the copy to match your executable, and then moves the copy to the bin directory.

To add an application configuration file to a C# project

  1. On the menu bar, choose Project > Add New Item.

    The Add New Item dialog box appears.

  2. Expand Installed > Visual C# Items, and then choose the Application Configuration File template.

  3. In the Name text box, enter a name, and then choose the Add button.

    A file named app.config is added to your project.

See also