ערוך

שתף באמצעות


Add an application configuration file to a C# project

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. 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.

Note

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

To add an application configuration file to a C# project:

  1. In Solution Explorer, right-click the project node, and then select Add > New Item.

    The Add New Item dialog box appears.

  2. Expand Installed > C# Items.

  3. In the middle pane, select the Application Configuration File template.

    Screenshot of the Application Configuration File item in the Add New Item dialog.

  4. Select the Add button.

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

    Screenshot of the App dot config file added to your project.

For more information about application configuration files or about assemblies in .NET, see How the runtime locates assemblies (.NET Framework) and Assemblies in .NET. To learn how to read application settings from an app.config file in .NET Framework, see How to: Read application settings.