XML : How to configure parameters.xml for web deploy with dynamic number of parameters in group

I was trying to use parameters.xml for web deployment of c# web project. it works fine if all parameters are pre-defined. however, in my situation, there is a group of same type items need to be configured and number of items in the group varies across different sites.

e.g. I have a group of items in web.config as below:

    <ItemConfiguration>      <items>        <item name="item1" label="1"  />        <item name="item2" label="2"  />        <item name="item3" label="3"  />             </items>    </ItemConfiguration>    

My Parameters.xml looks like:

    <parameter name="item1" defaultValue="&lt;item name='name' label='label' /&gt;">      <parameterEntry kind="XmlFile" scope="obj\\Release\\Package\\PackageTmp\\web\.config$"        match="/configuration/itemConfiguration/items" />    </parameter>      <parameter name="item2" defaultValue="&lt;item name='name' label='label' /&gt;">      <parameterEntry kind="XmlFile" scope="obj\\Release\\Package\\PackageTmp\\web\.config$"        match="/configuration/itemConfiguration/items" />    </parameter>      <parameter name="item3" defaultValue="&lt;item name='name' label='label' /&gt;">      <parameterEntry kind="XmlFile" scope="obj\\Release\\Package\\PackageTmp\\web\.config$"        match="/configuration/itemConfiguration/items" />    </parameter>    

and my SetParameters.xml for one of the deployment site:

  <?xml version="1.0" encoding="utf-8"?>  <parameters>    ...    <setParameter name="item1" value="&lt;item name='book1' label='book 1'  /&gt;" />    <setParameter name="item2" value="&lt;item name='book2' label='book 2'  /&gt;  " />    <setParameter name="item3" value="&lt;  /&gt;" />  </parameters>    

Above configuration allow me to set 2 items for deployment. My question is that if I need to configure more than the items defined in parameters.xml, say I want to have book1, book2, book3, and book4, then how can I do it? and another site might need 10 items configured in the group.

And as at the time of deploying the Parameters.xml cannot be changed anymore, only SetParameters.xml allow change, so I want to know whether I'm doing it the wrong way or there is a limitation for that.

thanks

No comments:

Post a Comment