2012-10-16 47 views
0

任何人都可以幫助我通過示例將參數(例如:URL)從CruiseControl.net ccnet.config文件傳遞到NANT name.build文件?參數解析CruiseControl.net到NANT

下面

是我試了一下(但沒有成功)

  **CC.net file** 

      <tasks> 
       <nant> 
        <executable>C:\Program Files (x86)\NANT\nant-0.92\bin\nant</executable> 
        <buildFile>C:\Program Files (x86)\NANT\nant-0.92\RiDM.Build</buildFile> 

        <targetList> 
         <target>build</target> 
        </targetList> 
        <buildArgs>-D:myProp=C:\build</buildArgs> 

       </nant> 
      </tasks> 

      **.build file** 

      <?xml version="1.0"?> 
       <project name="Parameter test File" > 
        <description>Test parameter passing among Cruise control and NANt files.enter code here </description> 


        <echo message="This is echo" /> 

        <if test="${property::exists('myProp')}" /> 
              <echo message="URL: ${myProp}" /> 
        <echo message="This is also echo" /> 

       </project> 

回答

1

你的nant構建文件缺少一個目標。

像echo一樣的函數調用必須位於目標中,然後在巡航控制中的buildArgs中指定目標。

http://nant.sourceforge.net/release/0.91/help/fundamentals/buildfiles.html

修改惡性腳本

<project name="Parameter test File" > 
    <description>Test parameter passing among Cruise control and NANt files.enter code here</description> 
    <target name="build"> 
    <echo message="This is echo" /> 
    <if test="${property::exists('myProp')}"> 
     <echo message="URL: ${myProp}" /> 
     <echo message="This is also echo" /> 
    </if> 
    </target> 
</project> 

nNant將執行目標(S)提在的ccnet.config的targetList元素,你的情況build

+0

感謝您的回覆,但仍然在黑暗中... – Leo

+0

你是什麼意思「仍然在黑暗中」?西蒙的回答應該能解決你的問題 –