1
votes

I'm trying to set up an IIS deployment step in my deploy process and I'm having trouble getting the right value to load into a web.config for a .netframework web app.

In my web config I have

<appsettings>
   <add key="hostname" value=""/>
</appsettings>

My goal is for it to end up like this

<appsettings>
   <add key="hostname" value="servername"/>
</appsettings>

I have the configuration variables feature turned on for the step, have enabled the "replace entries in .config files" option on, and imported a variable set that has a variable named "hostname" with a value of "servername"

I tried deploying it just as above but it didn't seem to do any transformation at all

I tried adding a project level variable named "hostname" with a value of "#{hostname}" but that gave me this result.

<appsettings>
   <add key="hostname" value="#{hostname}"/>
</appsettings>

The second one tells me that it recognizes the project level variable but it isn't recognizing the value as a variable. Is there something I'm missing to get it to recognize the #{hostname} value as a variable set variable?

1

1 Answers

1
votes

There are two items I can think of to check.

The first one is to verify that the library variable set is actually included in the project. It sounds like it might not be based on the behavior.

The second one is not to use the same name for the project and library variables. Having both named "hostname" means that one overwrites the other. Along with that, having a variable named "hostname" with a value of "#{hostname}" creates a loop and could be why you're seeing it replaced strangely.

Best, Ryan