如何使用cruise control.net在ccnet.config中设置msbuild脚本路径

时间:2013-07-02 11:28:36

标签: msbuild cruisecontrol.net cruisecontrol

当我尝试使用巡航控制来运行脚本时,我正处于低于执行状态。请查看我的代码并让我知道我在哪里做错了

<build date="2013-07-02 16:38:56" buildtime="00:00:00" error="true" buildcondition="ForceBuild">MSBUILD : error MSB1008: Only one project can be specified.
Switch: e:\mybuild.xml

ccnet.config文件

<cruisecontrol>
  <project name="Visteon">
    <webURL>http://localhost:333/ccnet/</webURL>

    <triggers>
      <intervalTrigger seconds="110" buildCondition="ForceBuild" />
    </triggers>

    <tasks>

     <msbuild>
        <executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable>

        <workingDirectory>E:\workingproject_5145</workingDirectory>

    <projectFile>myproject.sln</projectFile>

    <buildArgs>msbuild e:\mybuild.xml /t:Buildrun</buildArgs> 


    <timeout>120</timeout>

    <logger>C:\Program Files (x86)\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>

      </msbuild>




    </tasks>
  </project>

</cruisecontrol>

我的脚本在mybuild.xml中定义,如下所述

<Target Name="GetSource">
    <Message Text="Checking out trunk into $(SourceDirectory)" />
    <SvnCheckout RepositoryPath="$(SvnCheckoutPath)"
        LocalPath="$(CheckOutPath)"
        UserName="aa"
        Password="aa">
      <Output TaskParameter="Revision" PropertyName="Revision" />
    </SvnCheckout>
  </Target>
  <Target Name="Buildrun" DependsOnTargets="GetSource;Clean;" />
  <Target Name="Clean">
    <!-- Clean, then rebuild entire solution -->
    <MSBuild Projects="$(CheckOutPath)\myproject.sln" Targets="Clean;Rebuild" />
  </Target>

1 个答案:

答案 0 :(得分:0)

您的projectFile应该是xml文件...(即.msbuild文件)

我认为这就是你想要的。

 <projectFile>mybuild.xml</projectFile>

    <buildArgs>/t:Buildrun</buildArgs> 

LONG VERSION:

    <executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable>

    <workingDirectory>E:\workingproject_5145</workingDirectory>

    <projectFile>myproject.sln</projectFile>

    <buildArgs>msbuild e:\mybuild.xml /t:Buildrun</buildArgs> 

所以它会连接这些值

$ executable $ workingDirectory $ projectFile $ buildArgs

所以你得到这样的东西:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe E:\workingproject_5145\myproject.sln msbuild e:\mybuild.xml /t:Buildrun

这不是你想要的。

如果您制作如下值:

    <executable>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe</executable>

    <workingDirectory>E:\workingproject_5145</workingDirectory>

    <projectFile>mybuild.xml</projectFile>

    <buildArgs>/t:Buildrun</buildArgs> 

你会得到这样的东西:

    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe "E:\workingproject_5145\mybuild.xml" /t:Buildrun