开发者

Build Exception "Target ' ' does not exist in this project" when calling NAnt 0.91 from CCNET 1.6

I am refactoring my existing NAnt build scripts to be able to use them on just about any project and have the proper values sent over from CruiseControl .NET. I've come across an issue, though, where the Target isn't being set correctly.

I have defined my call to NAnt as follows:

  <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>

and my build file has the required required 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>

My error message states

Target framework: Microsoft .NET Framework 4.0 Target(s) specified:

build

 [echo] Starting the build script

BUILD FAILED

Target ' ' does not exist in this project.

Total time: 0.1 seconds.

Any ideas out there?

I can run the NAnt script suc开发者_高级运维cessfully via the command line:

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


This appears to be a bug introduced some time after v1.4.4.83. The solution was to change the node to be a single line. In my version 1.4.4.83 configuration, I have the buildArgs options on separate lines for increased readability.

My solution was to change

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

to

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜