Nant 构建失败 - 但仅限于 TeamCity
我设置了一个 nant 构建文件,可以在 cmd 行中正常工作,但在 TeamCity 中则不行。
我已经检查过我执行的命令是从 TC 正在工作的同一目录运行的,并检查了所有引用,但它仍然失败并出现以下错误:
[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)
有谁知道为什么 TC 无法运行构建吗?知道它有效吗?
干杯
w://
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://
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
默认情况下,TeamCity Build Agent 服务作为本地系统帐户运行。 如果您的测试或构建脚本需要无法使用该帐户访问的内容(在我的例子中是数据库连接),您有两个选择:
更改资源的权限以允许系统帐户访问
更改构建代理服务使用的帐户
更改服务帐户与任何其他 Windows 服务相同 -通过控制面板/管理工具/服务
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
我有这个问题。 您的
msbuild
任务中的详细程度是否设置为安静? 如果是这样,删除它,它可能会起作用——它对我有用。另请参阅此报告的错误(不是我的)。
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).
Team city 代理在与您正在使用的用户不同的用户下运行。 如果我没记错的话,您可以在安装代理时更改它,也可以更改运行代理服务的用户。
此外,您可以选择不将代理作为服务运行,而是将其作为普通命令行程序运行。
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.