Deleting config transformation files after deploy?

When deploying I have a couple of config files that I do transformations on. But after deploying I wan’t the transformations files to be deleted.

For example:

If i deploy this to produktion I want all the web.*.config files to be deleted after the transformation is done. Is there any way that I can make octopus handle this or do I have to put this in a powershell script?

Hi Daniel,

Currently a PostDeploy.ps1 PowerShell script is needed to delete them. Tentacle can’t delete them automatically since it’s possible that people might have files named App..config that isn’t necessarily a transform file.


Hi Paul,

as Octopus knows what files it has done transform on, this should be feasible, shouldn’t it? Would be a neat clean up feature. Has my vote :slight_smile:


Yes, although with one limitation - Octopus could delete the transform files it has run, but it would leave behind transforms it hasn’t run (e.g., web.staging.config would be left behind when deploying to production, but web.production.config would be deleted).


A big +1 to this. The CMS we use automatically imports .config files in certain directories, so anything “left over” causes serious issues. I’d love to see a solution where there was a checkbox that controlled removing any .config files that matched a pattern like .config or similar.

I have added this to my PostDeply-file to remove all transformation files from the application directory
get-childitem .\ -include *Test.config, *Stage.config, *Production.config -recurse | foreach ($_) {remove-item $_.fullname -force -whatif}

+1 to this. Running with Andreas solution for now.

a real solution is needed for this - I don’t want to spend my life adding this post deploy script with the risk of deleting too many things.

Thanks for weighing in - issue now tracking this at: