nant + msbuild error


I searched the forum, but haven't found anything on the problem below.
I installed teamcity on a linuxserver and a build agent on a windows XP machine. Configured a project, and everything seems to work fine. Detecting subversion changes, trigger the build, reporting results etc. However the build always fails.
I use a NANT build script that uses the msbuild task to build a visual studio 2005 solution. This build script work perfectly when run stand-alone or via CruiseControl.NET.
But in TeamCity it fails. It seems to me that TeamCity makes a patched version of the solution file, and tries to start that. But it doesn't contain the correct targets.
Why is this patched file there? And why doesn't it work? And most important how do I solve this problem? Any help is appreciated.

: nant (7s)
: build (4s)
: msbuild (4s)
: Project "BuildingBlocks.sln.teamcity.patch.tcprojx" (Rebuild;Build_TeamCity_generated_8c8c1530feb444028fe19afec287da19 target(s)): (<1s)
: [Project "BuildingBlocks.sln.teamcity.patch.tcprojx" (Rebuild;Build_TeamCity_generated_8c8c1530feb444028fe19afec287da19 target(s)):] C:\BuildAgent\work\741796eb2b4d6e6a\Components\BuildingBlocks\BuildingBlocks.sln.teamcity.patch.tcprojx error MSB4057: The target "Rebuild" does not exist in the project.
: C:\BuildAgent\work\741796eb2b4d6e6a\Components\BuildingBlocks\,6): External Program Failed: msbuild (return code was 1)
: Nested build failed. Refer to build log for exact reason.
: NAnt output: Target(s) specified: all Scanning assembly "NAnt.Contrib.Tasks" for extensions. init: clean: build: c:\Program Files\Microsoft Visual Studio 8\Common7\IDE c:\Program Files\Microsoft Visual Studio 8\Common7\IDE;c:\Program Files\Microsoft Visual Studio 8\VC\BIN;c:\Program Files\Microsoft Visual Studio 8\Common7\Tools;c:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;c:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin;c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;c:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;c:\tools;C:\PROGRA1\PVCS\vm\win32\bin;C:\PROGRA1\PVCS\vm\common\bin\win32;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\tic3x4x\c3x4x\cgtools\bin;;C:\PROGRA~1\ATT\Graphviz\bin;C:\Program Files\doxygen\bin start build BUILD FAILED C:\BuildAgent\work\741796eb2b4d6e6a\Components\BuildingBlocks\,6): External Program Failed: msbuild (return code was 1) Total time: 5 seconds. BUILD FAILED Nested build failed. Refer to build log for exact reason. Total time: 7.7 seconds.
: Process exit code: 1



I had the same problem. The problem was that I used NAntContrib msbuild task and in TeamCity there is also a msbuild task.
I changed my NAnt task to fit with TC definition.



TeamCity replaces NUnit Contrib msbuild task with specific one. It generates commandline for that and adds all necessary TeamCity specific properties and listeners. The problem is that TeamCity generated /p: key itself and msbuild.exe does not allow using /p twice.

I have created issue for that problem at
Please watch/vote for it

As workaround, please replace all /p: defined properties with ]]> tags inside msbuild task.



Please sign in to leave a comment.