.net core dotnet core编译时错误-System.Net.Sockets.SocketException(98):地址已在使用中

.net core dotnet core编译时错误-System.Net.Sockets.SocketException(98):地址已在使用中,.net-core,compiler-errors,compilation,compiler-warnings,.net Core,Compiler Errors,Compilation,Compiler Warnings,有时,在构建机器上运行构建时,我们在尝试运行“dotnettest”命令时会遇到多个错误。毕竟,生成成功,但错误是意外的,可能会令人困惑: /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 --configu

有时,在构建机器上运行构建时,我们在尝试运行“dotnettest”命令时会遇到多个错误。毕竟,生成成功,但错误是意外的,可能会令人困惑:

/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上运行build,并使用DotnetCore2.1