【发布时间】:2021-09-17 13:54:09
【问题描述】:
我们使用App Buddy 作为我们的 CI/CD 系统。今天我们将项目从ASP.NET Core 3.1 迁移到NET 5。在 dotnet 构建开始消耗大量 RAM(分配大约 10-12GB)之后,我们的服务器上没有那么多内存。
在dotnet build 期间,在我们的 CI/CD 服务器上,我们得到Microsoft.CSharp.Core.targets(71,5): error : Process terminated. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
我尝试过使用-maxCpuCount:1,但它不起作用。是否有可能限制dotnet build 可以使用的内存?
【问题讨论】:
-
你能分享你的 dotnet 构建命令吗?尝试使用
dotnet msbuild /maxcpucount:1而不是dotnet build在某些情况下有助于避免构建属性的神秘问题 -
@LeonidPavlov 我在帖子中提到它不适用于我的情况
-
@WojciechRak 我看到你用
dotnet build,我建议用dotnet msbuild -
@LeonidPavlov 不幸的是它也不起作用:
dotnet msbuild project.csproj /maxcpucount:1 /p:RestorePackages=false /p:BuildProjectReferences=false /p:Configuration=ReleaseMicrosoft (R) Build Engine version 16.11.0+0538acc04 for .NET Copyright (C) Microsoft Corporation. All rights reserved./usr/share/dotnet/sdk/5.0.401/Roslyn/Microsoft.CSharp.Core.targets(71,5): error : Process terminated. System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
标签: c# .net continuous-integration out-of-memory .net-5