Applying web.config transforms


I have created a Project that is kicked off as part of a CI build with TFS. I’m using OctoPack to create the nupkg file, and this is deployed to the web server.

We have 5 config files they are:

In visual studio I have set the build action to Content as you can see in img001.png

These files are included in the nupkg as you can see in img002.png

This file is successfully being uploaded to the Octopus server. When I create a release and target our UAT environment, the transform is being applied correctly as you can see in img003.png.

However, when the I view the site on the server, all of the transform files are there, as you can see in img004.png.

Under the step Deploy Package Step in the process I have the following parameters set - see img005.png

I’m happy to write an additional step in power shell to remove these files but I’m thinking I shouldn’t have to do that.

Many thanks,




Hi Shane,

Thanks for getting in touch! To use those dreaded words this is by design. As config files are secure, and as we don’t want to make assumptions on our customer’s behalf we leave these files.
If you want them to be deleted after deployment, you will have to write a PowerShell step to complete the process.



My searching skills aren’t up to scratch. I just found some more posts asking the same questions. I will use the solution provided by Daniel -

Many thanks.

Hi Shane,

Yeah, the library is a great resource for such things! I am glad you found this.