构建异常“目标” '此项目中不存在”从 CCNET 1.6 调用 NAnt 0.91 时
我正在重构现有的 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] 启动构建脚本
构建失败
此项目中不存在目标“ ”。
总时间: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
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 successfully 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这似乎是 v1.4.4.83 之后一段时间引入的错误。解决方案是将节点更改为单行。在我的版本 1.4.4.83 配置中,我将 buildArgs 选项放在单独的行上以提高可读性。
我的解决方案是
改为
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
to