Search code examples
octopus-deploy

Substitute Variables in web.config outside of appsettings, or connectionstring


The web.config in my nupkg file outputs the following:

<host>
          <baseAddresses>
            <add baseAddress="#{Url.AccountService}"/>
          </baseAddresses>
        </host>

According to Octopus' documentation on Substitute variables in files, the syntax above should be ok as long as I have the variable defined in my project. Which, I do.

enter image description here

I'm also deploying this package only to the DEV environment at this time.

enter image description here

Also, in the Deploy Website step, Under Substitute Variables in Files > I have web.config added to the list of files to perform the substitution on.

However, when the deployment goes through, octopus doesn't substitute this variable with the intended value. What am I doing wrong?


Solution

  • Per our conversation above and things you have tried. This is the only remaining idea I have for an answer for you:

    The documentation Substitute Variables in Files states:

    You need to state the full path of the file, relative to the installation directory. So, if you need to replace variables on a file called app.config that is inside of a configfolder on the root of your package, you need to put config\app.configon the Target files field.

    It is possible that Octopus Deploy cannot find the file that you are stating requires variable substitution. Everything else about your examples and code looks correct.