Custom .config don't transform

I have a project with a Config folder that contains custom configs. In the web.config I have:

And one of those is like this:

Then I have appropriately named section transformation configs

section1..config (example: section1.DEV.config)

This works well if I preview it in visual studio or if I transform it myself with a TransformToXml task in msBuild, so I know there should me no problem with the transformation file itself.

Using Octopus 3.3.1.2 I expect Octopus to handle these automatically because it is supposed to iterate all folders and then handle these: *..config

However the resulting built doesn’t contain the transformed configs and I don’t know what is wrong.

In the Log I can see:

Transforming ‘D:\Octopus\Applications\DEV…\Web.config’ using ‘D:\Octopus\Applications\DEV…\Web.Dev.config’.

And the Web.config file gets transformed successfully.

But no such thing happens for the other configs.
Is this normal?

I’ve also tried adding this:

*.#{Octopus.Environment.Name}.config => *.config

Although I really shouldn’t have to and it still doesn’t work

I solved it.

Build action was “None” by default.

Changing it to “Content” makes the transformation work.

This was not very easy to spot and not a very intuitive change so I hope it helps someone whose transformations are not working.

Hi,

Thanks for reaching out. I’m glad to hear you were able to solve it on your own.

When transformations don’t work, one of the first things you should check (even before checking the [File] => [file] rule), is check if the config files are inside of the nuget package or not. If they are not (like in your case) then you know there’s something funny going on during the packaging.

In Octopack’s documentation we mention that files have to be set to “Content” : http://docs.octopusdeploy.com/display/OD/Using+OctoPack . This will for the file to get added to the package, which will then make the transformation work.

Hopefully this troubleshooting tip will help anyone else that runs into this thread looking for help :slight_smile:

Cheers,
Dalmiro