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

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

问题描述

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

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.

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

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.

在部署 Web 应用程序时,app.config 文件的内容会发生什么变化?设置是否编译到 ProjectB.dll 中?

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

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

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

推荐答案

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

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

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

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天全站免登陆