wayne
wayne

Reputation:

Nant build fails - but only in TeamCity

I have a nant build file set up which works fine from the cmd line but not in TeamCity.

I've checked that the comand I execute is run from the same directory TC is working in and checked all the references but it still fails with the following error:

[build] Compile the project using Debug configuration...
[10:30:05]: [build] msbuild (1m:18s)
[10:30:06]: [msbuild] Starting MSBuild...
[10:30:07]: [msbuild] Starting 'C:\WINDOWS\Microsoft.NET\Framework\v3.5\msbuild.exe (@"G:\TeamCity\buildAgent\work\9de21b975852dd95\src\Irm.Web.App\Irm.Web.App.sln.teamcity.msbuild.tcargs")' in 'G:\TeamCity\buildAgent\work\9de21b975852dd95'
[10:30:09]: [msbuild] MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
[10:31:18]: [msbuild] Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
[10:31:18]: [msbuild] at Microsoft.Build.CommandLine.MSBuildApp.BuildProject(String projectFile, String[] targets, String toolsVersion, BuildPropertyGroup propertyBag, ILogger[] loggers, LoggerVerbosity verbosity, DistributedLoggerRecord[] distributedLoggerRecords, Boolean needToValidateProject, String schemaFile, Int32 cpuCount, Boolean enableNodeReuse)
[10:31:18]: [msbuild] at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
[10:31:18]: [msbuild] at Microsoft.Build.CommandLine.MSBuildApp.Main()
[10:31:24]: G:\TeamCity\buildAgent\work\9de21b975852dd95\Irm-deploy.build(22,10): External Program Failed: msbuild (return code was -1073741819)

Does anyone have any idea why TC would not be able to run the build yet I know it works?

Cheers

w://

Upvotes: 3

Views: 2741

Answers (3)

nickd
nickd

Reputation: 4021

I had this issue. Is the verbosity set to quiet in your msbuild task? If so, remove this and it might work -- it did for me.

See also this reported bug (not mine).

Upvotes: 3

Tom Clarkson
Tom Clarkson

Reputation: 16174

By default the TeamCity Build Agent service runs as the Local System account. If your tests or build script require something that cannot be accessed with that account (in my case it was a database connection) you have two options:

  • Change permissions on the resource to allow access by the system account

  • Change the account used by the build agent service

Changing the service account is the same as for any other windows service - via Control Panel / Administrative Tools / Services

Upvotes: 9

bh213
bh213

Reputation: 6539

Team city agent runs under different user than the one you are using. If I remember correctly, you can change that when you install the agent or you can change the user under which agent service is running.

Also, you could elect not to run agent as service and run it as normal command line program.

Upvotes: 1

Related Questions