Configuration transformation files leaves unwanted files in IIS Website

I had a question regarding the “Automatically run configuration transformation files” feature.

I have the following transformation files in addition to the base Web.config file:

Web.Debug.config
Web.Test.config
Web.Release.config

When I run my Octopus deploy with the “Automatically run configuration transformation files” setting turned on in my “Test” environment everything works great - the transformation works properly, the web site deploys properly to IIS.

However I notice in the deployed folder instead of seing one file called “Web.Config” with the transformed values I see all of the config files there like so:

Web.config
Web.Debug.config
Web.Test.config
Web.Release.config

What is the best way to tell Octopus to only deploy the transformed web.config file and not the others?

Hi Ken,

Thanks for getting in touch! As a rule of thumb Octopus will deploy anything you have inside the Nuget package (in this case all your config files). The fact that we do not delete the “other web configs” is actually by design. We consider config files very critical files, and we do not want to assume we have to delete them on our customer’s behalf.

If you want to delete the extra configs (web.*.config) and keep just the web.config, you can:

  1. do what Daniel proposes on this post (recommended) http://help.octopusdeploy.com/discussions/problems/4458-transforms-are-not-removed-on-deploy

  2. Add a PostDeploy.ps1 powershell script to your package to delete every config except “web.config”.

  3. Same as (2) but instead of a script inside of your package, a Standalone Powershell step doing the same.

You can find documentation for (2) and (3) on this link http://docs.octopusdeploy.com/display/OD/PowerShell+scripts

Hope that helps!

dalmiro

I noticed there is a solution to this by using the Octopus Deploy
Library File System - Clean Directory:
http://library.octopusdeploy.com/#!/step-template/actiontemplate-file-system-clean-directory

However I am new to Octopus and have no idea how to get this working.

Is there a tutorial to help?

[image: --]
Ken Burkhardt
[image: http://]about.me/kenburkhardt
http://about.me/kenburkhardt
"Every generation imagines itself to be more intelligent than the one that
went before it, and wiser than the one that comes after it." - George Orwell

Hi Ken,

Currently there is no tutorial or documentation page I can point you at.
However hopefully it is pretty straight forward:
On the library page there is a copy to clipboard button.
Then inside of Octopus you have Library -> Step templates.
There is an import button in the second tier top navigation that you can paste the copied library step to.

Hopefully the rest is easy enough to figure out using the library script information!
When it is all saved, this step will be available to add in projects process add a step.

Vanessa

Thank you I got it working! Appreciate the help!

[image: --]
Ken Burkhardt
[image: http://]about.me/kenburkhardt
http://about.me/kenburkhardt
"Every generation imagines itself to be more intelligent than the one that
went before it, and wiser than the one that comes after it." - George Orwell