Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 239
CodeBox Avatar asked Oct 13 '16 17:10

CodeBox


Video Answer


2 Answers

For regular .NET configurations you have the ability to add transform files based on build configurations. You can also use Slowcheetah which has a similar idea for files that are not standard .net configurations. The idea is to have one build configuation with it's corresponding transformation configurations. For example you configure on Visual Studio a build definition for CM and one for CD. With the transformation files you can have specific environment configurations based on the corresponding environment(configs for CM or CD). For deployment you can configure whatever tool you are using which build configuration it should use. For example to deploy to a CD environment you should build using the CD configuration and so on.

like image 133
Diego Avatar answered Oct 19 '22 22:10

Diego


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

like image 1
Hishaam Namooya Avatar answered Oct 19 '22 22:10

Hishaam Namooya