简体   繁体   English

.NET 网络配置文件

[英].NET web config file

I have a situation where I have a different web.config configuration for each branch and I need to merge constantly from branch A to Branch B, however every time I do so, I get the file to be overwritten.我有一种情况,每个分支都有不同的 web.config 配置,我需要不断地从分支 A 合并到分支 B,但是每次这样做时,我都会覆盖文件。 I was thinking of having variations of this file for each branch, something like:我正在考虑为每个分支设置此文件的变体,例如:

dev-Web.config prod-Web.config dev-Web.config prod-Web.config

Is this possible?这可能吗? Which approach would you take?你会采取哪种方法?

Here is what we do: Not using web.config for settings that change between environments.这是我们所做的: 不使用 web.config 进行环境之间更改的设置。

We have separate config files for this, and the application at runtime decides which one to use depending on a settings file (or a registry key - VERY handy for debugging as you just click a .reg file and be done).我们为此有单独的配置文件,运行时的应用程序根据设置文件(或注册表项 - 非常方便调试,因为您只需单击 .reg 文件即可完成)决定使用哪个。

Deployment scripts will choose which setting to write out dpending on the environmen name (ie use the name of the environment to copy a file with a similar name).部署脚本将选择在环境名称上写出 dpending 的设置(即使用环境名称复制具有相似名称的文件)。

But web.config never changes between 30 or so environments.但是 web.config 永远不会在 30 个左右的环境之间改变。

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

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