共用方式為


How to: Set up configuration information for an Office solution

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

You can use configuration files to configure settings that are specific to your Office solutions. You can specify settings such as assembly binding policy, remoting objects, debug, and trace settings.

Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects. See Features available by Office application and project type.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Personalize the IDE.

To add a configuration file to your Office project

  1. On the Project menu, click Add New Item.

  2. In the Categories pane, click General.

  3. In the Templates pane, select Application Configuration File.

  4. In the Name box, type the same name as the assembly plus the extension .config. For example, a configuration file for an Excel project assembly called ExcelWorkbook1.dll would be named ExcelWorkbook1.dll.config.

  5. Click Add.

  6. Create your configuration file according to the application configuration file schema. For more information, see Configuration file schema for the .NET Framework.

    There are no special considerations for using configuration files with Office projects.

See also