Best Approach For Configuring Multiple .Net Applications

前端 未结 5 1121
死守一世寂寞
死守一世寂寞 2020-12-11 07:10

We have a suite of interlinked .Net 3.5 applications. Some are web sites, some are web services, and some are windows applications. Each app currently has its own configurat

5条回答
  •  一个人的身影
    2020-12-11 08:15

    You can split App.config into multiple configuration files. You just specify the name of the file that contains the config section.

    Change app.config:

    
      
      
    
    
      
    
    

    Into app.config and SomeSetting.xml:

    
    
    

    Where SomeSetting.xml contains:

    Now you can compose your app.config from different section files with some sort of build or deploy script. E.g.:

    if debug copy SomeSettingDebug.xml deploydir/SomeSetting.xml
    if MySql copy OtherSectionMySql.xml deploydir/OtherSetting.xml
    

提交回复
热议问题