[我使用IoT工具在VScode中创建了现成的模板c#边缘解决方案,但在尝试构建和推送解决方案时收到以下错误:
Step 4/12 : RUN dotnet restore
---> Running in 22c6f8ceb80c
A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders
The command '/bin/sh -c dotnet restore' returned a non-zero code: 131
当它试图通过其中包含以下内容的Dockerfile.arm32v7中的命令运行时,这显然发生了:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster-arm32v7 AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim-arm32v7
WORKDIR /app
COPY --from=build-env /app/out ./
RUN useradd -ms /bin/bash moduleuser
USER moduleuser
ENTRYPOINT ["dotnet", "SampleModule.dll"]
这仅在为arm32v7构建时发生,但对amd64有效。我要在树莓派上使用建筑,所以我需要arm32。
在我看来,我的环境可能有问题,但不确定在哪里看?我还看到了一些注释,如果您希望它可以工作,则需要在ARM主机上进行构建,但是我以前从未在文档中看到过,并且从易于开发的角度来看也没有意义
[使用az acr build
提交构建时,您可以传入参数--platform linux/arm/v7
,这将为您提供ARM构建环境。