解決方法:撰寫.bat檔案,在裡面設定環境變數
例如
<cruisecontrol>
<project name="MyProject">
<triggers>ooxxooxx</triggers>
<sourcecontrol>ooxxooxx</sourcecontrol>
<tasks>
<msbuild>ooxxooxx</msbuild>
<exec>
<executable>myexec.bat</executable>
</exec>
<nunit>
<path>nunit-console.bat</path>
<assemblies><assembly>ox.dll</assembly></assemblies>
</nunit>
</tasks>
</project>
</cruisecontrol>
其中myexec.bat的內容可能是:
set MyVar=ooxx
myProg.exe
nunit-console.bat的目的則是為了讓unittest時也能夠用對環境變數:
set MyVar=ooxx
C:\oo\pp\xx\nunit-console.exe %1 %2 %3 %4 %5 %6 %7 %8 %9