4 Replies Latest reply on Aug 15, 2008 2:43 PM by Larry Eichenbaum

    Packaging parameterized config file (Web.config)

      What's the easiest way to do this?


      Currently, I have a component with a bunch of files and a Web.config config file. I want to parameterize several "values" in the config file such that, when I package it up from one server's component to push to another, those values get resolved based on properties of the target server.


      I can create the package, then go inside it and change those values to properties. This works fine. But we want this to be automatic, as we're planning on doing several pushes a day and quickly. The goal is to just package the component on source and immediately push to target.


      Aside from the path of the config file, there doesn't seem to be a way to "templatize" config files, either in the Component Template nor config file definition. What do you suggest to be the best way without having to go into the package every time we create it to re-parameterize the 40 values?



        • 1. Re: Packaging parameterized config file (Web.config)

          You may be able to modify the web.config first, and replace all those values with parameters. When you import the config file into a BLPackage, all the parameters will be there already.

          • 2. Re: Packaging parameterized config file (Web.config)

            Thanks for the response Yoway. I understand what you're suggesting, but it's not quite answering my question.


            So, for a BLPackage, I can parameterize all the items I'd like. For pushing that package, that's fine. But, this isn't giving me the full functionality I'm looking for. For instance, I'd like to audit my build machine's application component against the QA servers' application component. But, without parameterization, that audit will fail for web.config.


            Ideally, we could define these entries in the Component Template. It would let us parameterize entries like it lets us parameterize paths in the parts view. Then, when I package from a component (or audit two components), it will "know" how to read each system's web.config.

            • 3. Re: Packaging parameterized config file (Web.config)



              Not sure if you found your answer yet; we're doing something similar, so I defined entries in the Configuration Object Dictionary that use Server Properties as part of the path. We're using the default XML file grammar (xml.gm) to parse the config files, which has some issues regarding repeated tags if the number or ordering changes. I will probably delve into writing a custom grammar at some point...


              I started out using Component Templates with multiple instances per Server, but found that referencing Component properties is just not as easy as referencing Server properties (or even possible in some cases); we have an enhancement request out to be able to easily target Components using parameter syntax that will hoepfully resolve this issue,


              I haven't actually tried it, but you could try wild-carding the web.config configuration file and see if BL catches them all...


              Hope that helps,



              • 4. Re: Packaging parameterized config file (Web.config)

                Anyone make further progress on this? This may be coming past my desk soon...