【问题标题】:Build Exception "Target ' ' does not exist in this project" when calling NAnt 0.91 from CCNET 1.6从 CCNET 1.6 调用 NAnt 0.91 时生成异常“此项目中不存在目标”
【发布时间】:2011-09-15 21:19:46
【问题描述】:

我正在重构我现有的 NAnt 构建脚本,以便能够在几乎任何项目中使用它们,并从 CruiseControl .NET 发送正确的值。不过,我遇到了一个问题,即目标设置不正确。

我对 NAnt 的调用定义如下:

  <tasks>
    <nant>
      <executable>$(NAntExecutablePath)</executable>
      <buildFile>D:\ci\default.build.xml</buildFile>
      <!--baseDirectory></baseDirectory-->
      <buildArgs>
        -D:SolutionFile="$(Batch_WorkingFolderTrunk)\MySolution.sln"
        -D:LocalDeployRoot=D:\ci\deploy\MyProject
      </buildArgs>
      <targetList>
        <target>build</target>
      </targetList>
    </nant>
  </tasks>

并且我的构建文件具有所需的必需任务

  <target name="clean">
    <exec program="${MSBuildPath}">
      <arg line='"${SolutionFile}"' />
      <arg line="/property:Configuration=${SolutionConfiguration}" />
      <arg value="/target:Clean" />
      <arg value="/verbosity:normal" />
      <arg value="/nologo" />
      <arg line='/logger:"${CcnetMsbuildLoggerPath}"' if="${file::exists('${CcnetMsbuildLoggerPath}')}"/>
    </exec>

    <delete>
      <fileset basedir=".">
        <include name="bin\**\*" />
        <include name="TestResults\**\*" />
      </fileset>
    </delete>
  </target>

      <target name="build" depends="clean">

        <delete>
          <fileset basedir="${LocalDeployRoot}">
            <include name="**\*"/>
          </fileset>
        </delete>

        <exec program="${MSBuildPath}">
          <arg line='"${SolutionFile}"' />
          <!--arg line='/property:Configuration="${SolutionConfiguration}"' /-->
          <arg line='/property:OutputPath="${LocalDeployRoot}"' />
          <!--arg line='/property:Platform="${SolutionPlatform}"' /-->
          <arg value="/target:Rebuild" />
          <arg value="/verbosity:normal" />
          <arg value="/nologo" />
          <arg line='/logger:"${CcnetMsbuildLoggerPath}"' if="${file::exists('${CcnetMsbuildLoggerPath}')}"/>
        </exec>
      </target>

我的错误信息状态

目标框架:Microsoft .NET Framework 4.0 指定目标:
构建

 [echo] Starting the build script

构建失败

此项目中不存在目标“”。

总时间:0.1 秒。

有什么想法吗?

我可以通过命令行成功运行NAnt脚本:

D:\ci>nant-0.91\bin\nant.exe /f:default.build.xml build -D:SolutionFile="D:\ci\code\MyProject\MySolution.sln" -D:LocalDeployRoot= D:\ci\deploy\MyProject

【问题讨论】:

    标签: continuous-integration cruisecontrol.net nant


    【解决方案1】:

    这似乎是在 v1.4.4.83 之后一段时间引入的错误。解决方案是将节点更改为单行。在我的 1.4.4.83 版本配置中,我将 buildArgs 选项放在单独的行中以提高可读性。

    我的解决办法是改变

    <buildArgs>
      -D:SolutionFile="$(Batch_WorkingFolderTrunk)\MySolution.sln"
      -D:LocalDeployRoot=D:\ci\deploy\MyProject
    </buildArgs>
    

    <buildArgs>-D:SolutionFile="$(Batch_WorkingFolderTrunk)\MySolution.sln" -D:LocalDeployRoot=D:\ci\deploy\MyProject</buildArgs>
    

    【讨论】:

      猜你喜欢
      • 2022-06-22
      • 2011-05-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-02
      相关资源
      最近更新 更多