Mixing web.config transforms and Parameters.xml, or something to that effect

Viewed 2351

I've been using web.config transforms for a while now, for deployment on a few of our projects. What I'm now trying to achieve, is to have Web Deploy's 'Import Package' screen to prompt to check & update several of the variables in , adjusted for each environment.

I know I can use Parameters.xml to introduce these editable variables, but I haven't yet found how to have the defaults updated for different environment targets.

Consider the following neat, but non-overlapping example of wanting to have the user edit the 'specialServer' AppSetting, and have it present a different default when compiled for the NewEnv target:

Sample entry in Parameters.xml:

<parameter name="Special server" description="" tags="" defaultValue="server1-dev.domain">
    <parameterEntry kind="XmlFile" scope="\\web.config$" match="/configuration/appSettings/add[@key='specialServer']/@value" />
</parameter>

Sample transform for Web.NewEnv.config, setting a different value for

<appSettings>
    <add key="specialServer"
        value="other-server.domain2"
        xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
</appSettings>

Sample of the prompt in Web Deploy:

enter image description here

Any suggestions as to how to update the default value for different build targets?

Thanks.

2 Answers
Related