Search code examples
c#asp.net-mvcsitecoresitecore8

How to keep different configs i.e. CD and CMS in Tfs?


Im trying keep different configs files for separate environment CD&CMS, is there any tools or option i can use ?

im using vs2013 with tfs.

Thanks


Solution

  • You can create a directory structure where you keep the CM and CD files. Below is an example of the directory structure

    ---App_Config

    -----Include

    --------zConfig

    -----------CM Config

    -----------CD Config

    Then you can create a build script which takes into consideration the Build Configuration (debug, release). From this, when you build your solution it will know which config to take.

    I would suggest to define new Build Configuration to minimiythe risk of confusion. Example, create 1 for CM and 1 for CD

    This is an example how my build script looks like in my solution

    if %Configuration% EQU  DEBUG ( if exist %SolutionDir%..\..\Website\App_Config\Include\ABBs\UAT  RMDIR /S /Q  %SolutionDir%..\..\Website\App_Config\Include\ABBs\UAT  if exist %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster1 RMDIR /S /Q  %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster1 if exist %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster2 RMDIR /S /Q  %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster2 if exist %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster3 RMDIR /S /Q  %SolutionDir%..\..\Website\App_Config\Include\ABBs\PRODCluster3 )
    

    It will copy the config file from my solution to the path \Website\App_Config\Include\ABBs\PRODCluster1 if my Build Configuration is Debug