在Google Cloud>Workloads中部署应用程序时,我在日志资源管理器中出错
找不到任何兼容的框架版本
找不到框架“Microsoft.NetCore.App”版本“3.1.0”。
找到了以下框架:5.0.4在[/usr/share/dotnet/shared/microsoft.netcore.app]
您可以通过安装指定的框架和/或SDK来解决此问题。
可在以下网址找到指定的框架:
https://aka.ms/dotnet-core-applaunch?framework=microsoft.netcore.app&framework_version=3.1.0&arch=x64&rid=debian.10-x64
我的DockerFile:
FROM mcr.microsoft.com/dotnet/sdk
COPY . /app
WORKDIR /app
RUN dotnet publish -c Release -o out
COPY /out .
ENTRYPOINT ["dotnet", "Test.dll"]
您使用的是SDK
的最新映像,在本例中是5.0.4
版本。您需要将其3.1.0
用作您的应用程序:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
请尝试以下DockerFile中的一个:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster
WORKDIR /app
COPY ./bin/Debug/netcoreapp3.1 .
EXPOSE 80
ENV ASPNETCORE_URLS "http://*:80"
ENTRYPOINT ["dotnet", "Test.dll"]
或
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "Test.dll"]```