locked
TransformXml solution level parent config file RRS feed

  • Question

  • User1421948165 posted

    I have managed creating a msbuild file (batch) which basically when provided the attributes of the FilesToTransform=environment.config, creates the environment specific transformed config files at a particular location. I haven't added configuration manually but created environment specific config files manually and then a build script to perform TransformXml for the FilesToTransform parameter. You can view it here


    I then include those additional config files with my build and the package is created having those transformed config files. Then I provide a batch file (which accepts environment name as parameter e.g.  Deploy Stage) which will deploy the package to particular environment and perform msdeploy -replace on particular environment file.

     So far my proof of concept works and now I want to start integrating it in our practical solution.

    We got a solution with approximately 70 projects. Almost all the projects have got Log4Net, smtp configurations in web/app.config. I don't intend to copy paste those particular config section across all the projects. Can I implement something like having a solution level PARENT config file which I will transform first and then project level?

    Friday, June 24, 2011 1:41 AM

Answers

  • User1421948165 posted

    Hi Sayed,

    Thanks for your generous alternative mate. Actually, I managed to get it done as follows.

    What I was looking for was two level transform files. One at solution level which basically contains common configuration related to all the projects (we have approximately 80 projects). Config entries that can exist at solution level are for example Logging (log4net), smtp details etc. So if we ever change the smtp details, we don't have to go about changing the smtp details in all the projects (I don't trust copy/paste/replace as sometimes it can do more than we have requested :) )

    My Solution Basically I used the solution at here and extended to fit my purpose. I first transformed project level config (they exist in the Project/Transforms directory) and then saved the transformed file in Temp build directory. Then applied the solution level transform to the file saved in Temp directory. So basically it's a two way process to generate the transformed files for all the environment.

    P.S. Again, your book (Inside MSBuild...) has come to my rescue many times. I was pretty newbie as far as manually writing MSBuild scripts, but your book probably got me up to speed in couple of days, huge saving of time and sometimes, google won't help you as much as reading a good book and yours is definitely the one.

    Let me know if I could have done the above in any other efficient way.

    Thanks,

     Nimesh

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, July 3, 2011 9:58 PM

All replies

  • User-828474155 posted

     Hi, I wrote the book that the SO answer refers to :)

    Can you send me a mail so that I can work with you offline sayedha [AT] [microsoft dotCOM]? After we resolve your situation we can update this post with the relevant info.

     Thanks,
    Sayed Ibrahim Hashimi

    Friday, July 1, 2011 2:01 AM
  • User1421948165 posted

    Hi Sayed,

    Thanks for your generous alternative mate. Actually, I managed to get it done as follows.

    What I was looking for was two level transform files. One at solution level which basically contains common configuration related to all the projects (we have approximately 80 projects). Config entries that can exist at solution level are for example Logging (log4net), smtp details etc. So if we ever change the smtp details, we don't have to go about changing the smtp details in all the projects (I don't trust copy/paste/replace as sometimes it can do more than we have requested :) )

    My Solution Basically I used the solution at here and extended to fit my purpose. I first transformed project level config (they exist in the Project/Transforms directory) and then saved the transformed file in Temp build directory. Then applied the solution level transform to the file saved in Temp directory. So basically it's a two way process to generate the transformed files for all the environment.

    P.S. Again, your book (Inside MSBuild...) has come to my rescue many times. I was pretty newbie as far as manually writing MSBuild scripts, but your book probably got me up to speed in couple of days, huge saving of time and sometimes, google won't help you as much as reading a good book and yours is definitely the one.

    Let me know if I could have done the above in any other efficient way.

    Thanks,

     Nimesh

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Sunday, July 3, 2011 9:58 PM