Sometimes before you start building you need to perform some more additional actions on build server(e.g. clean up some folder or replace config files). The way out is to use PowerShell. You can easily specify tag in CruiseControl.NET project configuration file and add PowerShell task.
<powershell> <scriptsDirectory>C:\project1\scripts</scriptsDirectory><!--Scrips folder--> <script>delLogs.ps1</script> <buildArgs>-workingDir C:\project1\working</buildArgs><!-- Project working folder--> <executable>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</executable><!--PowerShell exe file path--> <buildTimeoutSeconds>30</buildTimeoutSeconds> <description>Deleted previous build test result files</description> </powershell>
So using this task you can do lots of after and before tasks.
If you have problems with PowerShell launching on your build machine read the following article: http://technet.microsoft.com/en-us/library/ee176949.aspx
Great post, thx!
Wasn´t aware that there are PowerShell-Tasks in CC.Net, before that I tried to use via the Exec-Task.
One additional question: Any idea on how to execute PowerShell-Scripts from CC.Net if there´s a blank in the scriptpath? (Have a look here for what I mean: http://arcware.net/running-a-powershell-script-with-a-space-in-the-path/ )
Thx & Regards,
Christian
Hi,
I’ ve never met the problem like that… and currently have no change to test it…
The easiest way out try to avoid using white spaces…