Transforms and variables not applied to app.config for Azure Worker package

I have a worker role that uses variables in the deployment and transforms in the package. The variables are correctly getting applied to the ServiceConfiguration.Cloud.cscfg file. Variables and transform files are not however being applied against the app.config files for the project.

I have app.config and log4net.config. Tranforms files that exist in the worker role package are log4net.Release.config and [AssemblyName].Staging.config and [AssemblyName].Production.config (matching my Staging and Production environments).

The log for this part of the process does not indicate any variables or transforms being applied to these files.

Initial variable evaluation performed.

03:10:16 Verbose | Initial variable evaluation performed.
03:10:16 Verbose | Variables have been fully evaluated.
03:10:16 Verbose | Running procedure 'Delete temporary package files’
03:10:16 Verbose | Looking for any configuration transformation files
03:10:16 Verbose | Looking for appSettings and connectionStrings in any .config files

The log then goes on to outline the changes made for changes to the cscfg file

Success: Update ServiceConfiguration.Cloud.cscfg

Thoughts?

Is it because this needs to be applied to the files in the worker role package but the deploy process is only applying these actions against the contents of the nuget package?

Hi Rory,

Thanks for getting in touch! Yeah you got it. Currently we only run transforms on anything inside the Nupkg and we do not expand the cscfg file.
But this functionality is coming as part of the ‘Deeper Azure support’ we have in 3.0.
Until then one of our awesome customers came up with a solution to support it now:
http://help.octopusdeploy.com/discussions/problems/8463-config-transforms-not-working-on-azure

Hope that helps!
Vanessa

Thanks Vanessa.

Hi Vanessa,
does Octopus support variables substitution right now for Worker role? We have version 3.3.1 installed but on some reason variables in the .config file of the Worker Role are not transformed.

I enabled feature "Substitute variable in files and have following target files:
*.cscfg

*.config

But in the log of the corresponding step Octopus says:
No files were found that match the substitution target pattern '*.config'

What should I do to substitute variables in the .config file ?

Hi Konstantin,

Our Substitute variables in files feature does not recursively search through directories. So if your config files are outside of the main folder they will not be found.
You would need to define the path. You can add wildcards for the filename but not for the path itself. Could you confirm that your .config files are not inside folders?
Maybe provide a screenshot of where they exist in your NuGet package.

Let me know what you find.
Vanessa

Thanks Vanessa, this helped. I solved the problem.