使用MSBuild进行并行构建的问题

时间:2014-07-04 18:11:37

标签: multithreading visual-studio serialization msbuild parallels

我们试图运行下一个命令:

MSBuild.exe ..\src\YaccConstructor.WithoutTests.sln /t:Build /m:8 /v:q /p:Optimize="True" /p:DebugSymbols="True" /p:Configuration="Release" /logger:Fake.MsBuildLogger+TeamCityLogger,"C:\Users\User\Documents\Project\recursive-ascent\tools\Build.Tools\Fake\FakeLib.dll" /logger:Fake.MsBuildLogger+ErrorLogger,"C:\Users\User\Documents\Project\recursive-ascent\tools\Build.Tools\Fake\FakeLib.dll"

之后我们得到了下一个例外:

MSBUILD : error MSB4166: Child node "6" exited prematurely. Shutting down. Diagnostic information may be found in files in the temporary files directory named MSBuild_*.failure.txt.

在MSBuild _ *中,failure.txt是下一个信息:

    System.Runtime.Serialization.SerializationException: Type 'Microsoft.Build.BackEnd.TaskHost' in Assembly 'Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
   at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
   at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
   at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)
   at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
   at Microsoft.Build.BackEnd.NodePacketTranslator.NodePacketWriteTranslator.TranslateDotNet[T](T& value)
   at Microsoft.Build.Shared.LogMessagePacketBase.WriteToStream(INodePacketTranslator translator)
   at Microsoft.Build.Shared.LogMessagePacketBase.Translate(INodePacketTranslator translator)
   at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.PacketPumpProc()

我们已经看到了以下所有信息:

Compiler Issue in Windows 7: A generic error occurred in GDI+

error MSB4166: Child node exited prematurely. Shutting down

MSBUILD fails with "The process cannot access the file xxxxx because it is being used by another process." when maxcpucount is greater than 1

没有任何帮助。

任何人都知道如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

尝试使用MsBuild 4.0显式调用构建以排除版本12.0

尝试省略/ logger开关,排除自定义记录器。

尝试通过注释/ M开关来排除并行构建。

尝试将诊断输出管道传输到单独的文件,看看是否可以更加保真地处理错误。

%windir%\Microsoft.NET\Framework\v4.0.30319 ..\src\YaccConstructor.WithoutTests.sln /t:Build /m /v:q /p:Optimize="True";DebugSymbols="True";Configuration="Release" /fl1 /flp1:Verbosity=diag;logfile=msbuild_diag.log