[英]How to add app.config to Visual Studio 2012 Web Express lib project?
How can I add a configuration file to Visual Studio 2012 Web Express library project? 如何将配置文件添加到Visual Studio 2012 Web Express库项目?
I tried following the msdn instructions but I just don't have the Application Configuration File
template. 我尝试遵循msdn说明,但我没有
Application Configuration File
模板。 I tried looking all over in the properties of the project to specify the config file, but it's nowhere to be found. 我试着在项目的属性中查找指定配置文件,但它无处可寻。
Any ideas? 有任何想法吗?
Libraries don't generally have configuration files. 库通常没有配置文件。 When an application loads, the configuration it loads will be the one associated with that application - not the libraries within it.
加载应用程序时,它加载的配置将是与该应用程序关联的配置 - 而不是其中的库。
You can create app config files for libraries, and load them explicitly - but it's a bit of a pain. 您可以为库创建应用程序配置文件,并明确加载它们 - 但这有点痛苦。 Consider exposing configuration directly in your API, and allowing the application consuming the library to provide the configuration appropriately.
考虑直接在API中公开配置,并允许使用库的应用程序适当地提供配置。
在ASP.NET中,它被称为“Web应用程序文件”,该文件名称为“web.config”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.