TeamCity: could not find target in MSBuild project

I have some problems replacing TeamCity MSBuild, I think.

I tried to compile a Delphi 2010 project (compatible with MSBuild) with NAnt using the MSBuild (NAnt Contrib) task.

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

If I try 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 tried to explicitly set the target using 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 is converted using xsl, but it is still a valid project file)

Edit2:

Thanks. ermakovich, I replaced the msbuild task (from NAnt contrib) with a direct call to NAnt, which does not cause an error on the TeamCity server. TeamCity seems to replace the NAnt contrib msbuild task call. :-)

  <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> 
+6
continuous-integration msbuild nant teamcity
source share
2 answers

It seems that you are using the / target switch on the console command line. Please try to specify the targets that you need in the build configuration settings in the TeamCity web interface, as suggested in the error message. Yon can find this option on the Runner tab in the TeamCity project configuration. Enter goals separated by a space or semicolon. Build, rebuild, clear, publish goals are supported by default.

+3
source share

Instead of specifying the build target on the command line or command, you can verify that DefaultTargets="..." defined in the <Project> in the project file.

0
source share

All Articles