合并多个配置文件

时间:2021-04-28 22:59:59

I have the following config files in my C:\Configs directory

我的C:\Configs目录中有以下配置文件

  1. app.enviroment.config
  2. app.enviroment.config
  3. app.dev.config
  4. app.dev.config
  5. app.production.config
  6. app.production.config

app.environment.config just contains this dev which can be change from dev to production depending on which config file I want to merge with the main App.config at runtime. How do I make this merge happen, that's either merging from app.dev.config or app.production.config base on the value is picks from dev. A sample code will be much appreciated.

app.environment。config只包含这个dev,根据我想要在运行时与主App.config合并的配置文件,可以从dev更改为产品。我如何使这个合并发生,它可以从app.dev.config或app.production合并。配置基础上的值是从dev中挑选的。示例代码将非常感谢。

I am taking this approach because we have quite a lot of developers working on the same project and I don't want anyone stepping on each others toes.

我采用这种方法是因为我们有很多开发人员在同一个项目上工作,我不希望任何人踩到别人的脚趾。

1 个解决方案

#1


1  

You can do it with the extension called SlowCheetah http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/

你可以使用名为SlowCheetah http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/的扩展名。

Please have a look at Scott Hanselmans blog how to do the transformation using SlowCheetah http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx

请查看Scott Hanselmans的博客如何使用SlowCheetah http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx进行转换

#1


1  

You can do it with the extension called SlowCheetah http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/

你可以使用名为SlowCheetah http://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5/的扩展名。

Please have a look at Scott Hanselmans blog how to do the transformation using SlowCheetah http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx

请查看Scott Hanselmans的博客如何使用SlowCheetah http://www.hanselman.com/blog/SlowCheetahWebconfigTransformationSyntaxNowGeneralizedForAnyXMLConfigurationFile.aspx进行转换