vb.net Visual Studio 2013 和 Update 2(间歇性构建错误)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23791689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 17:34:55  来源:igfitidea点击:

Visual Studio 2013 and Update 2 (Intermittent Build Errors)

c#vb.netvisual-studiovisual-studio-2013

提问by Denis

When we installed SP2 we started noticing the following when building solutions:

当我们安装 SP2 时,我们在构建解决方案时开始注意到以下内容:

ERROR C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2348,5): Task host node exited prematurely. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt. 
ERROR C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2366,7): The "GenerateResource" task's outputs could not be retrieved from the "FilesWritten" parameter. Object does not match target type.

And then looking at one of the MSBuild_*.failure.txt files I see:

然后查看我看到的 MSBuild_*.failure.txt 文件之一:

UNHANDLED EXCEPTIONS FROM PROCESS 26072:
=====================
5/20/2014 4:18:22 PM
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.Collections.Generic.Dictionary`2.Initialize(Int32 capacity)
   at System.Collections.Generic.Dictionary`2..ctor(Int32 capacity, IEqualityComparer`1 comparer)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.TranslateDictionary(Dictionary`2& dictionary, IEqualityComparer`1 comparer)
   at Microsoft.Build.BackEnd.TaskParameter.ReadITaskItem(INodePacketTranslator translator, ITaskItem& wrappedItem)
   at Microsoft.Build.BackEnd.TaskParameter.TranslateITaskItemArray(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskParameter.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskParameter.FactoryForDeserialization(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.Translate[T](T& value, NodePacketValueFactory`1 factory)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketReadTranslator.TranslateDictionary[T](Dictionary`2& dictionary, IEqualityComparer`1 comparer, NodePacketValueFactory`1 valueFactory)
   at Microsoft.Build.BackEnd.TaskHostConfiguration.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.TaskHostConfiguration.FactoryForDeserialization(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketFactory.PacketFactoryRecord.DeserializeAndRoutePacket(Int32 nodeId, INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodePacketFactory.DeserializeAndRoutePacket(Int32 nodeId, NodePacketType packetType, INodePacketTranslator translator)
   at Microsoft.Build.CommandLine.OutOfProcTaskHostNode.DeserializeAndRoutePacket(Int32 nodeId, NodePacketType packetType, INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.PacketPumpProc()
===================

It seems to happen on the first time we build a solution and then stops happening for awhile and then comes back and then goes away for awhile. Any ideas on how to fix this? I can't be out-of-memory as I am ONLY running VS2013 & a couple of IE instancens on a 64bit system with 8GB of RAM.

它似乎发生在我们第一次构建解决方案时,然后停止发生一段时间,然后回来然后消失一段时间。有想法该怎么解决这个吗?我不能内存不足,因为我只在具有 8GB RAM 的 64 位系统上运行 VS2013 和几个 IE 实例。

采纳答案by Doc Brown

I was getting exactly the same behaviour after installing VS 2013 Update 2, but not when compiling directly from inside Visual Studio. I got these errors when using msbuildin our separate build scripts (a collection of Windows "bat" files). These scripts were using

在安装 VS 2013 Update 2 后,我得到了完全相同的行为,但在直接从 Visual Studio 内部编译时却没有。msbuild在我们单独的构建脚本(Windows“bat”文件的集合)中使用时,我遇到了这些错误。这些脚本正在使用

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe

Luckily, the path to this program is configurable for all of our scripts in a single place (by using some kind of include mechanism). I exchanged it by

幸运的是,这个程序的路径可以在一个地方为我们所有的脚本配置(通过使用某种包含机制)。我换了

C:\Program Files (x86)\MSBuild.0\Bin\MSBuild.exe

and now everything seems to be fine. The latter "MSBuild.exe" seems to be a newer version which was installed as part of the "Upgrade 2", the former is the version belonging to .NET framework 4.

现在一切似乎都很好。后者“MSBuild.exe”似乎是作为“升级 2”的一部分安装的较新版本,前者是属于 .NET framework 4 的版本。

I also tried the amd64 version mentioned by @J.J.Hashemi, but it gave me some nasty warnings about the processor architecture of some framework DLLs not matching my target architecture.

我还尝试了@JJHashemi 提到的 amd64 版本,但它给了我一些关于某些框架 DLL 的处理器架构与我的目标架构不匹配的令人讨厌的警告。

回答by J.J. Hashemi

I solved this by replacing C:\Program Files (x86)\MSBuild\12.0\Bin with C:\Program Files (x86)\MSBuild\12.0\Bin\amd64

我通过用 C:\Program Files (x86)\MSBuild\12.0\Bin\amd64 替换 C:\Program Files (x86)\MSBuild\12.0\Bin 解决了这个问题