Kus*_*han 7 msbuild tfs visual-studio-2013
我对MSBuild/TFS有一个非常奇怪且难以诊断的问题.我有一个包含大约12种不同构建配置的解决方案.在构建服务器上运行时,构建该批次可能需要30分钟,并且已经运行好几周,但现在偶尔会失败.
大多数情况下,当它失败时,它将是这样的错误:
19:25:45.037 2> TestPlanDocument.cpp(1):致命错误C1093:API调用'GetAssemblyRefHash'失败'0x8007000e':ErrorMessage:没有足够的存储空间来完成此操作.[C:\ Builds\1\ICCSim卡测试控制器\ ICCSimCTC Release\src\CardTestController\CardTestController.vcxproj]
错误有时会发生在另一个文件上.它不会发生在每个构建配置中,它非常不一致,偶尔甚至会成功构建所有构建配置.构建配置之间没有太大的不同,主要是它只是一些字符串更改,当然它们都在本地构建就好了.
有问题的API调用通常 GetAssemblyRefHash但并非总是如此.我认为这不是问题,因为GetAssemblyRefHash的Googling特别提到了什么.我怀疑这里有一些资源问题,但我不知道:有足够的硬盘空间(数百GB),大量的RAM(机器最初分配的最小4GB但是动态,因为它是超级的-v - 它从未超过2.5GB.我将这个增加到8GB以防万一,并且没有变化).
我已经将构建详细程度设置为诊断,并且它没有真正显示任何其他有用的信息,只是相同的错误.
作为参考,构建服务器在所有修补程序上都是最新的.它运行的是Windows Server 2012 R2,安装了TFS 2013和VS 2013,两者都在Update 4上.
我现在真的很茫然,并会感激任何帮助或指点.
编辑:为了让人们保持最新,编译工具链处于32位模式,但即使切换到64位后,问题仍然存在.
Okay, I have an update to this! I opened a support ticket with Microsoft and have been busy working with them to figure out the issue. They went down the same paths as outlined above and came to the same conclusion - it's not a resources issue.
To cut a long story short, Microsoft has now acknowledged that this is likely a bug in the VC++ compiler, which is almost certainly caused by a race condition (Though this is unconfirmed). There's no word on if they'll fix it in a future release.
There is a workaround by using the /MP flag at the project level to limit the number of compiler processes opened by MSBuild without disabling multiple instances entirely (Which for me was doubling build times).
To do this, go to your project properties and under Configuration Properties -> C/C++ -> Command Line, you need to specify the /MP flag and then a number to limit the number of processes.

我的构建服务器有 8 个虚拟 CPU,正常行为与 /MP8 等效,但这会导致有时出现错误。对我来说,使用 /MP4 似乎足以限制错误,而不会导致构建时间增加太多。如果您看到与此类似的错误,您可能需要尝试使用其他数字,例如 /MP6 或 /MP2。