有时,在构建机上运行构建时,尝试运行“ dotnet test”命令时遇到多个错误。毕竟,构建成功,但是错误是意外的,并且可能令人困惑:
/usr/bin/dotnet test /home/vsts_agent3/VSTS-Desktop-agents/_work/15/s/Name.Tests.csproj --logger trx --results-directory /home/vsts_agent3/VSTS-Desktop-agents/_work/_temp --configuration Prod
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.Net.Sockets.SocketException (98): Address already in use
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.IO.Pipes.NamedPipeServerStream.SharedServer..ctor(String path, Int32 maxCount)
at System.IO.Pipes.NamedPipeServerStream.SharedServer.Get(String path, Int32 maxCount)
at System.IO.Pipes.NamedPipeServerStream.Create(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize, HandleInheritability inheritability)
at System.IO.Pipes.NamedPipeServerStream..ctor(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize, HandleInheritability inheritability)
at System.IO.Pipes.NamedPipeServerStream..ctor(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize)
at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.InternalConstruct(String pipeName)
at Microsoft.Build.Execution.OutOfProcNode.Run(Boolean enableReuse, Exception& shutdownException)
at Microsoft.Build.CommandLine.MSBuildApp.StartLocalNode(CommandLineSwitches commandLineSwitches)
at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, List`1& distributedLoggerRecords, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, Boolean recursing)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
错误可以重复几次,但是最终构建成功并执行测试:
Build started, please wait...
Build completed.
Test run for /home/vsts_agent3/VSTS-Desktop-agents/_work/15/s/Project.Web.Tests/bin/Prod/netcoreapp2.1/Name.Tests.dll(.NETCoreApp,Version=v2.1)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
似乎MSBuildApp在内部启动了一些服务器来编译源代码。很高兴理解为什么要确保我们拥有安全的CI / CD管道。
我们正在Ubuntu上运行构建并使用dotnet core 2.1。