首页 > 解决方案 > 使用 --no-build 发布 ReadyToRun 依赖于框架的 lambda

问题描述

我一直在为 AWS Lambdas 构建管道,并希望添加 ReadyToRun 功能以减少启动时间。我注意到为了完成发布步骤,我需要删除--no-build标志。这个重建步骤似乎运行得相当快,所以这不是问题,但我很好奇为什么需要它。

这似乎没有在任何地方记录,没有它,它runtimeconfig.json与依赖于框架的部署不兼容。所以基本上--no-build是不兼容的--no-self-contained

对于上下文,我们使用最新的 .net core 3.1 SDK 和一些其他内部工具构建了一个基于 Alipne 的自定义容器。恢复/构建步骤首先运行,因此我们可以运行所有测试,最后压缩由 CI 管道的其余部分拾取的可分发包。第一步之后的所有内容都带有--no-build标志,除了现在的dotnet publish步骤。

这些命令基本上可以归结为:

dotnet build --configuration Release --runtime linux-x64 # also takes care of the restore step
dotnet test --no-build # with some filters and coverage targets
dotnet publish --configuration Release --runtime linux-x64 --no-self-contained --framework "netcoreapp3.1" /p:ReadyToRun=true /p:GenerateRuntimeConfigurationFiles=true

标签: .net-corebuild

解决方案


推荐阅读