msbuild.exe保持打开状态,锁定文件 [英] msbuild.exe staying open, locking files

查看:321
本文介绍了msbuild.exe保持打开状态,锁定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用TeamCity,后者依次调用msbuild(.NET 4).我有一个奇怪的问题,就是在构建完成后(无论构建成功与否,这都无关紧要),msbuild.exe保持打开状态并锁定其中一个文件,这意味着TeamCity每次尝试清除其工作目录,它将失败,并且无法继续.

I use TeamCity which in turn invokes msbuild (.NET 4). I have a strange issue in that after a build is complete (and it doesn't seem to matter if it was a successful build or not), msbuild.exe stays open, and locks one of the files, which means every time TeamCity tries to clear its work directory, it fails, and can't continue.

这种情况几乎每次都会发生.

This happens almost every time.

我真的迷失了这个,所以我会尽力提供尽可能多的细节.

I'm really lost on this one, so I'll try to provide as much detail as possible.

  • 服务器是2 GB内存的Intel Core i7,具有Windows Server 2008标准64位SP2.
  • 在TeamCity中,使用/m命令行参数(这意味着要使用多个内核)配置msbuild运行程序
  • 有问题的文件总是是.NET项目之一中在路径External Tools\Telerik\Telerik.Reporting.Dll中引用的相同外部DLL. (External Tools目录中还包含其他几个.DLL文件,它们的路径结构相似,它们从未引起此问题).目前,这是Telerik报告的试用版,以防万一.
  • 发生问题时,任务管理器中始终列出几个msbuild.exe *32进程:我相信有7个进程.使用Process Explorer,它们看起来都像顶级进程(没有父级).它们都使用20-50MB的内存和0.0%的CPU.
  • 如果我等待1-3分钟,则msbuild.exe进程将自行退出,然后TeamCity可以正确更新工作目录.
  • 如果我手动终止msbuild进程,TeamCity的更新将立即再次起作用.
  • 在Windows中关闭了索引服务(尽管前两点几乎可以肯定是msbuild.exe引起了问题).
  • Telerik.reporting.dll没有特殊属性.唯一的SVN属性是svn:mime-type = application/octet-stream
  • Server is an Intel Core i7, 2 GB ram, with Windows Server 2008 standard 64-bit SP2.
  • In TeamCity, the msbuild runner is configured with the /m command-line parameter (which means to use multiple cores)
  • The file in question is ALWAYS the same external DLL that is referenced in one of the .NET projects, in the path External Tools\Telerik\Telerik.Reporting.Dll. (There are several other .DLL files included in the External Tools dir in a similar path structure which never cause this problem). Currently this is with the trial version of Telerik reports, in case that makes any difference.
  • When the issue happens, there are always several msbuild.exe *32 processes listed in Task manager: I believe there are 7. Using Process Explorer, they all look like top-level processes (no parents). They're all using from 20-50MB ram, and 0.0% CPU.
  • If I wait 1-3 minutes, the msbuild.exe processes exit on their own, and TeamCity can then update the work directory properly.
  • If I manually terminate the msbuild processes, TeamCity's update will work again immediately.
  • Indexing services are turned off in Windows (though the prior two points pretty much confirm it's msbuild.exe causing the problem).
  • There are no special properties on Telerik.reporting.dll. The only SVN property is svn:mime-type = application/octet-stream

以前有人遇到过吗?

推荐答案

msbuild/nr:false一起使用.

简而言之:MSBuild试图做很多事情以提高速度,特别是对于并行构建.它将产生许多节点"-可以编译项目的单个msbuild.exe进程,由于进程花了一些时间启动,因此在构建完成后,这些进程会挂起(默认情况下,持续15分钟,我认为),这样,如果您碰巧很快要重新构建,则可以重用"这些节点并节省过程设置成本.但是您可以通过使用上述命令行选项关闭nodeReuse来禁用该行为.

Briefly: MSBuild tries to do lots of things to be fast, especially with parallel builds. It will spawn lots of "nodes" - individual msbuild.exe processes that can compile projects, and since processes take a little time to spin up, after the build is done, these processes hang around (by default, for 15 minutes, I think), so that if you happen to build again soon, these nodes can be "reused" and save the process setup cost. But you can disable that behavior by turning off nodeReuse with the aforementioned command-line option.

另请参阅:

MSBuild命令行参考

不会锁定自定义MSBuild任务DLL的并行构建

MultiProc MSBuild中的节点重用

这篇关于msbuild.exe保持打开状态,锁定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆