config files using msbuild RRS feed

  • Question

  • I am trying to automate our build. Different environements would have different set of values for the properties in the config file. What are my options if I am using msbuild?
    Tuesday, April 24, 2007 9:51 PM


All replies

  • Properties can be set externally on the command line (check out the /p option of MSBuild). When you change which system a build is done on or for, just set a property externally (i.e. have a batch file that invokes msbuild on the solution file and sets your property), then inside the msbuild file you can check the value of that property and change the build behaviour accordingly.
    Wednesday, April 25, 2007 12:11 PM
  • I did not mean msbuild properties. For example if I have different database connection string etc which I would like to set in the config file for different evnironment. Then I was going to have one feeder file which stores all the different environment settings in msbuild xml format, and then have a batch file or something populate the actual config file with the values based on the environment. The question then is about this batch file, any ideas on this. I guess I could write a msbuild task to accomplish this, but I was hoping there was native msbuild way to do it.
    Wednesday, April 25, 2007 2:33 PM
  • Okay, for that i would suggest you use either the XmlWrite or RegexReplace community tasks (available from http://www.msbuildtasks.tigris.org).



    Wednesday, April 25, 2007 9:36 PM