.net-core - 使用 --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
解决方案
推荐阅读
- swift - SpriteKit 场景的大小/缩放不正确
- azure - 排除 Azure CI 管道 (YAML) 中的某些文件
- google-sheets - 如何检查 IMAGE 公式中使用的 url 是否正确并显示图像?
- c# - 正则表达式拆分换行符 - 在匹配结束时保留捕获的换行符
- php - 以特定方式显示文件夹中的图片 - PHP
- java - 测试在本地通过,但在 git 管道中失败
- javascript - 在 React 上单击父元素时如何触发子元素?
- python - 图像不会显示:dtype 对象的图像数据无法转换为浮点数
- microsoft-graph-api - 尝试使用 MS Graph API 创建 apload 会话时出现 HTTP 错误 405
- python - 遍历文件夹中的文件名并使用 Python 重命名