I have 3 config files in my windows service c# application naming dev.config, QA.config and prod.config.
I have added 3 new Configuration Managers dev, QA and Prod and also added a prebuild event in the project properties which copies the appropriate appropriate config file into AppConfig before building the application.
xcopy /y "$(ProjectDir)ConfigFiles\$(Configuration).config" "$(ProjectDir)App.config"
Now with this method , I need to build the code everytime I need to deploy in each environment.
Command used to build code each time:
msbuild.exe solutionname.sln /t:Rebuild /p:Configuration=Dev
msbuild.exe solutionname.sln /t:Rebuild /p:Configuration=QA
msbuild.exe solutionname.sln /t:Rebuild /p:Configuration=Prod
Is there any way I can use the same binaries to deploy into all the environments without having to build it everytime.Something like set environment variables in each machine and use them to determine which environment we are in and automatically use the appropriate config file through code.
Any help on this is highly appreciated.