Substitute variables in files - not happening


Using Octopus 3.2.3.

In my web.config I have “#{pLogPath}” specified in a log4net section. This must be replaced by deployment specific location. I have added “pLogPath” as a variable. And I have specified “Web.config” in the process “Substitute variables in files” section…

But the tag is not replaced in web.config. Why not?


Hi Itemplate,
Just to make sure i’m clear about your set up could you send through a screenshot of your variable values and project configuration along with a log of the deployment.
If I understand correctly you have an un scoped variable #{pLogPath} with some path value in your project variables. You then have some item in configuration like <element key="#{pLogPath}" /> (obviously with different element/attribute names) and in the variable substitution you have added web.config which maps to a file called web.config in the root directory of your project. If this is all the case then it should be working correctly. I believe the variable replacement configuration is also case sensitive so could you make sure you have the correct casing for web.config and if not, then try again.

If all this is correct and its still not working, then once we have the extra details we will try to get to the bottom of the problem.

Hi Rob,

I’m embarrased. You see I just found this link:

Here my problem lies because the variables was put in my web.config using xml transformation. Yet since the variable substitution happens before transformation, it ends up as if nothing worked,.

I should have guessed that order - but was mislead as the logs didn’t mention the variable substitution at all (or I didn’t find it). Based on that I thought it didn’t happen…

This is my theory after sleeping on it. I shall confirm in a couple of hours and get back…

Yes that was the reason.
Thanks for helping out - it got me in the correct direction.

Glad to hear you got things working. Feel free to contact us again if you come up with any further issues.