引用项目中的app.config会发生什么 [英] What happens to app.config in a referenced project

查看:84
本文介绍了引用项目中的app.config会发生什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有2个项目,其中项目A引用项目B.项目A是Web应用程序项目,项目B是类库.

类库具有一个app.config文件,其中存储了一些设置.当我编译项目A时,将在bin文件夹中创建projectB.dll.

部署Web应用程序后,app.config文件的内容会如何处理?设置是否已编译到ProjectB.dll中?

是否可以使用反射器或ILSpy之类的工具检索app.config的内容?

解决方案

您可以将app.config添加到库项目中,但是未使用或包含在任何输出中./p>

配置应在应用程序中完成,而不是在库中完成.因此,您需要将有问题的配置放在Web应用程序的web.config中,而不是在库的app.config中.

Say I have 2 projects, where project A references project B. Project A is a web application project and project B is a class library.

The class library has an app.config file where some settings are stored. When I compile project A, projectB.dll is created in the bin folder.

What happens to the contents of the app.config file when the web application is deployed? Are the settings compiled into ProjectB.dll?

Is it possible to retrieve the contents of the app.config using a tool like reflector or ILSpy?

解决方案

You can add an app.config to a library project, but it is not used or included in any of the output.

Configuration is meant to be done in the application - not in the library. So you need to put the configuration in question in the web.config of your web application, not in app.config of a library.

这篇关于引用项目中的app.config会发生什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆