TeamCity:无法在MSBuild项目中检测目标 [英] TeamCity: Failed to detect target in MSBuild project

查看:84
本文介绍了TeamCity:无法在MSBuild项目中检测目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为更换TeamCity MSBuild时遇到一些问题.

I have some problems with the TeamCity MSBuild replacement I think.

我试图使用MSBuild任务(NAnt Contrib)用NAnt编译Delphi 2010项目(符合MSBuild).

I've tried to compile a Delphi 2010 Project (MSBuild compliant) with NAnt using the MSBuild task (NAnt Contrib).

如果在控制台上没有TeamCity的情况下一切正常,则一切正常.

Everything works fine, if I do it without TeamCity on the console.

如果我在TeamCity上尝试使用,则会收到以下错误消息:

If I try it with TeamCity, I get the following error message:

Failed to detect default target(s) in the project file  F:\CI\TeamCity\TeamCity\buildAgent\work\892195dab42324a3\build\src.temp\TestProject\Test.dproj.  Please define targets explicitly in the build configuration options on  TeamCity Web UI. Project does not define DefaultTargets or  InitialTargets.

我试图通过指向重建目标的MSBuild/target开关显式设置目标.到目前为止没有运气.

I've tried to explicitly set the target via the MSBuild /target switch pointing to the Rebuild target. So far no luck.

有什么建议吗?预先感谢.

Any Suggestions? Thanks in advance.

    <foreach item="File" property="iterator.dproj">
        <in>
            <items>
                <include name="${src.temp}\**\*.dproj" />
            </items>
        </in>
        <do>
            <msbuild project="${iterator.dproj}">
                <arg value="/target:Rebuild" />                 
            </msbuild>
        </do>
    </foreach>

*.dproj文件是标准的delphi 2010项目文件(已使用xsl转换,但仍然是有效的项目文件)

The *.dproj file is a standard delphi 2010 project file (it's transformed with xsl but it's still a valid project file)

Edit2:

感谢s. ermakovich,我用直接调用NAnt替换了msbuild任务(来自NAnt contrib),这在TeamCity服务器上不产生错误.看起来TeamCity只替换了对NAnt contrib msbuild任务的调用. :-)

Thanks to s. ermakovich, I replaced the msbuild task (from NAnt contrib) with the direct call to NAnt, which does not produce the error on TeamCity server. Looks like TeamCity does only replace the call to NAnt contrib msbuild task. :-)

    <property name="msbuild.exe" value="${framework::get-framework-directory(nant.settings.currentframework)}\msbuild.exe" />
    <foreach item="File" property="iterator.dproj">
        <in>
            <items>
                <include name="${src.temp}\**\*.dproj" />
            </items>
        </in>
        <do>
            <exec program="${msbuild.exe}">
                <arg path="${iterator.dproj}" />
            </exec>
        </do>
    </foreach>

推荐答案

似乎您在控制台命令行中使用了/target 开关.请尝试在TeamCity Web UI的构建配置选项中指定所需的目标,这是错误消息所建议的. Yon可以在TeamCity项目配置的 Runner 选项卡上找到此参数.输入目标,以空格或分号分隔.默认情况下,支持构建,重建,清理,发布目标.

It seems that you are using /target switch in your console command line. Please, try to specify target(s) that you need in the build configuration options on TeamCity Web UI, as it is suggested by the error message. Yon can find this parameter on the Runner tab of the TeamCity project configuration. Enter targets separated by space or semicolon. Build, Rebuild, Clean, Publish targets are supported by default.

这篇关于TeamCity:无法在MSBuild项目中检测目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆