类库的 app.config [英] app.config for a class library
问题描述
我看不到 VS2008 向导为类库生成的 app.config 文件.在我的研究中,我发现在一个应用程序中只有一个 app.config 存在.
I cannot see a app.config file generated for a class library by the VS2008 wizard. In my research I found that in an application only one app.config exists.
手动将 app.config 添加到类库是一件坏事,还是有任何其他方法可以满足类库中 app.config 的目的?
Is it a bad thing to add an app.config manually to a class library or are there any other methods which will serve the purpose of an app.config in class library?
我需要在 app.config 文件中存储 log4net 配置信息.
I need to store log4net config information inside the app.config file.
推荐答案
您通常应该不要将 app.config
文件添加到类库项目中;如果你没有一些痛苦的弯曲和扭曲,它就不会被使用.它根本不会伤害图书馆项目 - 它根本不会做任何事情.
You generally should not add an app.config
file to a class library project; it won't be used without some painful bending and twisting on your part. It doesn't hurt the library project at all - it just won't do anything at all.
相反,您配置使用您的库的应用程序;所以所需的配置信息将放在那里.每个可能使用您的库的应用程序可能会有不同的要求,因此这实际上也合乎逻辑.
Instead, you configure the application which is using your library; so the configuration information required would go there. Each application that might use your library likely will have different requirements, so this actually makes logical sense, too.
这篇关于类库的 app.config的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!