Task Block 类型:
- Build Publisher
- Email Publisher
- Executable Task
- File Merge Task
- FinalBuilder Task
- ForceBuildPublisher
- Modification Writer Task
- MsBuild Task
- NAnt Task
- Null Task
- NUnit Task
- Statistics Publisher
- Visual Studio Task
- Xml Log Publisher
任务是顺序执行的,这里我只提Build Publisher,NUnit Task,MsBuild Task,Executable Task,Email Publisher
1.Build Publisher
编译成功后,如何发布
<
buildpublisher
>
< sourceDir > C:\myprojects\project1 </ sourceDir >
< publishDir > \\myfileserver\project1 </ publishDir >
< useLabelSubDirectory > false </ useLabelSubDirectory >
</ buildpublisher >
< sourceDir > C:\myprojects\project1 </ sourceDir >
< publishDir > \\myfileserver\project1 </ publishDir >
< useLabelSubDirectory > false </ useLabelSubDirectory >
</ buildpublisher >
sourceDir:源文件地址
publishDir:要发布到的地址
<useLabelSubDirectory>:是否每一个版本根据label标签创建一个字目录里并把发布内容放进去
2.MsBuild Task
<
msbuild
>
< executable > C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe </ executable >
< workingDirectory > C:\dev\ccnet </ workingDirectory >
< projectFile > CCNet.sln </ projectFile >
< buildArgs > /noconsolelogger /p:Configuration=Debug /v:diag </ buildArgs >
< targets > Build;Test </ targets >
< timeout > 15 </ timeout >
< logger > C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll </ logger >
</ msbuild >
< executable > C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe </ executable >
< workingDirectory > C:\dev\ccnet </ workingDirectory >
< projectFile > CCNet.sln </ projectFile >
< buildArgs > /noconsolelogger /p:Configuration=Debug /v:diag </ buildArgs >
< targets > Build;Test </ targets >
< timeout > 15 </ timeout >
< logger > C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll </ logger >
</ msbuild >
这个不用解释了,但是ThoughtWorks.CruiseControl.MsBuild.dll是个单独组件,前面我提过
3.NUnit Task
编译后运行测试
<
tasks
>
< nunit > < path > D:\dev\ccnet\ccnet\tools\nunit\nunit-console.exe </ path >
< assemblies >
< assembly > D:\dev\Refactoring\bin\Debug\Refactoring.exe </ assembly >
< assembly > D:\dev\Refactoring\bin\Debug\Refactoring.Core.dll </ assembly >
</ assemblies >
</ nunit >
</ tasks >
< nunit > < path > D:\dev\ccnet\ccnet\tools\nunit\nunit-console.exe </ path >
< assemblies >
< assembly > D:\dev\Refactoring\bin\Debug\Refactoring.exe </ assembly >
< assembly > D:\dev\Refactoring\bin\Debug\Refactoring.Core.dll </ assembly >
</ assemblies >
</ nunit >
</ tasks >
4. Executable Task
执行一个程序
示例1:<exec executable="c:\projects\myproject\build.bat"/>
示例2:
<
exec
>
< executable > make </ executable >
< baseDirectory > D:\dev\MyProject </ baseDirectory >
< buildArgs > all </ buildArgs >
< buildTimeoutSeconds > 10 </ buildTimeoutSeconds >
</ exec >
< executable > make </ executable >
< baseDirectory > D:\dev\MyProject </ baseDirectory >
< buildArgs > all </ buildArgs >
< buildTimeoutSeconds > 10 </ buildTimeoutSeconds >
</ exec >
你可以在这里加载任何你需要执行的程序,比如Fxcop等
5. Email Publisher
邮件通知编译报告
<
email
from
="buildmaster@mycompany.com"
mailhost
="smtp.mycompany.com"
mailhostUsername ="smtpuser" mailhostPassword ="smtppassword" includeDetails ="TRUE" >
< users >
< user name ="BuildGuru" group ="buildmaster" address ="buildguru@mycompany.com" />
< user name ="JoeDeveloper" group ="developers" address ="joedeveloper@thoughtworks.com" />
</ users >
< groups >
< group name ="developers" notification ="change" />
< group name ="buildmaster" notification ="always" />
</ groups >
</ email >
mailhostUsername ="smtpuser" mailhostPassword ="smtppassword" includeDetails ="TRUE" >
< users >
< user name ="BuildGuru" group ="buildmaster" address ="buildguru@mycompany.com" />
< user name ="JoeDeveloper" group ="developers" address ="joedeveloper@thoughtworks.com" />
</ users >
< groups >
< group name ="developers" notification ="change" />
< group name ="buildmaster" notification ="always" />
</ groups >
</ email >
notification: