leec
(Lee Cook)
January 29, 2013, 8:16pm
1
Hi,
So we have setup our project with Config Transforms. The transforms work and get executed but it doesn’t seem to clean up it’s self. So it leaves all the transforms there. Is this expected behaviour? Could I be doing something wrong?
We are using the latest version of OctopusDeploy.
Thanks,
Le
leec
(Lee Cook)
January 29, 2013, 8:31pm
2
leec
(Lee Cook)
January 29, 2013, 9:09pm
3
For people looking for the actual code, here is how I achieved it:
#remove all the transforms
gci $OctopusOriginalPackageDirectoryPath -include *.Production.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Staging.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Production-CMS.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Staging-CMS.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Development.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Release.config -Recurse -Force | Remove-Item -Recurse -Force
gci $OctopusOriginalPackageDirectoryPath -include *.Debug.config -Recurse -Force | Remove-Item -Recurse -Force
Rather than doing it for each environment, I use the following powershell command in my PostDeploy.ps1 file:
Remove-Item *.config -exclude *.exe.config | Write-Host
Hi,
I’m glad you found a solution.
In the latest version of Octopus Deploy you can also use the File System - Clean Directory template from the Octopus Deploy Library , which was created to do just that.
Configuration would look like this:
File System - Clean Directory
Files to remove: web.*.config
Files to ignore:
Paths to clean: [StepName].Output.Package.InstallationDirectoryPath
Daniel