Skip to content

CruiseControl.NET: PowerShell tasks

March 18, 2011

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.

<scriptsDirectory>C:\project1\scripts</scriptsDirectory><!--Scrips folder-->
 <buildArgs>-workingDir C:\project1\working</buildArgs><!-- Project working folder-->
 <executable>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</executable><!--PowerShell exe file path-->
 <description>Deleted previous build test result files</description>

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:

  1. 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: )

    Thx & Regards,

  2. 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…

Trackbacks & Pingbacks

  1. CruiseControl.NET: PowerShell tasks II « QA Questions

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: