Substitution in exe.config file does not work

execution

#1

Hi,

I want to substitute a value in *.exe.config files by Substitute variables in files feature. Octopus finds all files in installation directory but does not replace any values.

I added line below to my exe.config file inside of appSettings as
< key="ConnectionEnvironment" value="#{Value}" /> and set values for Value variable on Variables tab on Octopus but still does not work.

11:50:29 Info | Performing variable substitution on ‘C:***.exe.config.deploy’
11:50:29 Info | Performing variable substitution on ‘C:***.exe.config.deploy’
11:50:29 Info | Performing variable substitution on ’ ‘C:***.exe.config.deploy’
11:50:29 Info | Performing variable substitution on ‘C:***.exe.config.deploy’
11:50:29 Verbose | Looking for appSettings, applicationSettings, and connectionStrings in any .config files

Do you have any suggestions to substitute the value that I set?

Thanks,
Cansel


(Kenneth Bates) #3

Hi Cansel,

Thanks for getting in touch! That’s strange that it’s finding the files but not successfully substituting. Giving this a test in my local instance, defining C:\path\*.exe.config* in the variable substitution feature correctly substitutes my unscoped Value variable into both *.exe.config and *.exe.config.deploy files.

Could you provide some additional information to ensure I’m testing it out exactly as you have it configured?

  • How do you have your Value project variable scoped?
  • What do you have defined in the Target files field in the Substitute Variables in Files feature?
  • Could you provide a copy of your verbose deployment logs with debugging variables enabled, as shown in our documentation?

I look forward to hearing back and getting to the bottom of this one!

Best regards,

Kenny


#4

Hi Kenny,

I changed app.config as

<appSettings>     
<add key="ConnectionEnvironment" value="#{ConnectionEnvironment}" />  
</appSettings>

My Variables are like in the picture.

Target file is defined as #{DeploymentPath}\Application Files***.exe.config.deploy

09:19:32   Verbose  |       [ConnectionEnvironment] = 'Test'
09:19:37   Info     |       Performing variable substitution on 'C:\**\*.exe.config.deploy'
09:19:37   Info     |       Performing variable substitution on 'C:**\*.exe.config.deploy'
09:19:37   Info     |       Performing variable substitution on 'C:\**\*.exe.config.deploy'
09:19:37   Info     |       Performing variable substitution on 'C:\**\*.exe.config.deploy'
09:19:37   Verbose  |       Looking for appSettings, applicationSettings, and connectionStrings in any .config files

But in *exe.config.deploy, variable is same as in app.config after deployment.

<appSettings>
     <add key="ConnectionEnvironment" value="#{ConnectionEnvironment}" />
  </appSettings>

Regards,
Cansel


(Kenneth Bates) #5

Hi Cansel,

Thanks for following up. Unfortunately I’m still unable to reproduce this behavior. Am I assuming correctly that the line in your log (Performing variable substitution on 'C:\**\*.exe.config.deploy') is in fact listing out the individual file names, and the **\* is just sanitizing the file names?

If possible, could you provide the full log file itself to give me some more context to dig further into this? You can email it to us directly and privately at support at octopus dot com and I can get it from there, or you can mark this thread as private.

I look forward to hearing back and finally getting to the bottom of this one!

Best regards,

Kenny


(system) #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.