简体   繁体   English

如何在构建过程之外合并xml app.config文件

[英]How to merge xml app.config files outside of the build process

I would like to use app.config files for settings, but I don't want to have to select different build configurations to select which settings to use, I would rather everything build in release and then just the app.config file be different when the application is deployed. 我想使用app.config文件进行设置,但我不想选择不同的构建配置来选择要使用的设置,我宁愿所有版本都在发行版中构建,然后当app.config文件不同时应用程序已部署。

What is a good way to merge two xml files together so that I can deploy the correct settings to the correct environment? 将两个xml文件合并在一起以便将正确的设置部署到正确的环境的一种好方法是什么? I have found several solutions that are based on selecting different build configurations and the transform happens at build time, but I want the transform to just be from a command line utility that my deploy script can run 我发现了几种基于选择不同构建配置的解决方案,并且转换是在构建时进行的,但是我希望转换仅来自我的部署脚本可以运行的命令行实用程序

At my company, we use the Web Config Transformation Runner , available on GitHub. 在我公司,我们使用GitHub上的Web Config Transformation Runner It may be invoked directly from the command line, a bit like this: 可以直接从命令行调用它,如下所示:

D:\Utils\WebConfigTransformRunner.exe App.config App.production.config App.config

We've incorporated this into a larger packaging and deployment process to handle deploying to our various environments. 我们已将其合并到更大的打包和部署过程中,以处理部署到我们各种环境中的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM