single app.config multi-project c#

前端 未结 7 1940
清歌不尽
清歌不尽 2020-11-27 15:10

I want to use a single app.config by 3 different projects.

How to access the configurations?

ConfigurationManager.AppSettings[\"config1\"]

7条回答
  •  忘掉有多难
    2020-11-27 15:40

    One design option is to avoid accessing the app.config directly from your class library projects altogether, thus avoiding the extra external dependency.

    Rather, only your executable project knows about the config file and it can explicitly pass the appropriate config information to the libraries when it creates objects from them or initializes them.

提交回复
热议问题