在我看來,更好的解決方案是使用一些構建腳本,如NAnt或MSBuild。然後你的CruiseControl .NET只執行構建腳本的一部分。通常構建腳本比ccnet.config更容易維護。
此外,調試更容易,因爲您可以手動運行構建腳本的任何部分。
例中的MSBuild:您可以先製作一個XML的文件(讓我們稱之爲MyTasks.msbuild):
<Project DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ProjectA">
<!-- Your project build-scripting...-->
<Exec Command="echo Hello A"/>
</Target>
<Target Name="ProjectB">
<!-- Your project build-scripting...-->
<Exec Command="echo Hello B"/>
</Target>
<Target Name="All">
<CallTarget Targets="ProjectA" />
<CallTarget Targets="ProjectB" />
</Target>
</Project>
如果你喜歡從命令行使用它,只需鍵入「的MSBuild MyTasks.msbuild 「 然後在的ccnet.config:
<project name="ProjectA" >
<!-- ... -->
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.21006\MSBuild.exe</executable>
<timeout>3600</timeout>
<logger>C:\Program Files\CruiseControl\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<workingDirectory>C:\Temp\CI\</workingDirectory>
<projectFile>C:\MyTasks.msbuild</projectFile>
<buildArgs>/toolsversion:4.0 /p:Configuration=Debug;</buildArgs>
<targets>ProjectA</targets>
<description>Building Project A</description>
</msbuild>
</tasks>
<!-- ... -->
</project>
<project name="All" >
<!-- ... -->
<tasks>
<msbuild>
<executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.21006\MSBuild.exe</executable>
<timeout>3600</timeout>
<logger>C:\Program Files\CruiseControl\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
<workingDirectory>C:\Temp\CI\</workingDirectory>
<projectFile>C:\MyTasks.msbuild</projectFile>
<buildArgs>/toolsversion:4.0 /p:Configuration=Debug;</buildArgs>
<targets>All</targets>
<description>Building Project A and B</description>
</msbuild>
</tasks>
<!-- ... -->
</project>
唯一不好的是,如果您的構建將採取類似20分鐘,你不知道在CC狀態。但可以固定爲您的項目名稱=「所有」可能有很多MSBuild任務:
<project name="All" >
<!-- ... -->
<tasks>
<msbuild>
<!-- ... -->
<targets>ProjectA</targets>
</msbuild>
<msbuild>
<!-- ... -->
<targets>ProjectB</targets>
</msbuild>
</tasks>
<!-- ... -->
</project>
希望這有助於...