通用配置文件
我有 4 个 .net 控制台应用程序,它们执行不同的任务。这 4 个应用程序共享一些我通过 app.config 文件传递的通用配置。我可以将所有配置放在一个通用配置文件中并从中读取,而不是分别读取 4 个 applicationname.exe.config 文件吗?
I have got 4 .net console applications which carry out different tasks. These 4 applications share some common configuration that I pass through app.config file. Can I put all the configuration in one common config file and read from that instead of each of the 4 applicationname.exe.config file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 ConfigSource。基本上,它们允许您引用 app.config 中的不同文件。
这是它的工作原理,
External.config
您需要做的是将所有配置文件中的公共部分“重构”为外部文件,并从主配置文件中引用它们。
You can use ConfigSource. Basically they allow you to reference different files within your app.config.
here is how it would work,
External.config
what you need to do is to 'refactor' the common parts from all the config files to external files and reference them from your main config files.
是的,你可以这样做。如果您创建一个单独的配置项目并从不同的项目中引用它们,您可以访问相同的键/值对。 IE;配置。
看看我之前的问题。
Yes you can do that. if you create a separate configuration project and refer to them from your different projects you can access the same key/value pairs. ie; configuration.
Look at my previous question.