views:

43

answers:

2

Hi Everybody,

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

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

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

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.

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.

Edit:

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

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

Edit2:

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

This might help http://bjarte.com/post/continuous-integration-with-team-city-and-msb

SilverSkin
Sorry this does unfortunately not help. As I said: Console is fine, TeamCity fails. As far as I know TeamCity has an internal MSBuild replacement. Any way to disable it?
Dennis
A: 

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.

s.ermakovich
As I mentioned in my question, TeamCity calls an NAnt script with embedded msbuild command. Everything works fine in console but TeamCity reports an error.
Dennis
What exactly do you execute via console? MSBuild.exe? Could you provide please an axample how do you use MSBuild task in the NAnt script?
s.ermakovich