0

failed to solve: process "/bin/sh -c dotnet build "WebApplication1.csproj" -c Release -o /app/build" did not complete successfully: exit code: 1

Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["WebApplication1.csproj", "WebApplication1/"]
COPY ["*/ClassLibrary1.csproj", "ClassLibrary1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj" -r linux-arm64
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build  "WebApplication1.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

Docker:

enter image description here

What's the problem, please

May I ask what the problem is

1 Answers1

0

You can read the build error within the docker log, it says error CS5001: Program does not container a static 'Main' see here for an answer.

Shahar Shokrani
  • 7,598
  • 9
  • 48
  • 91
  • Thank you very much for your answer. The problem has been solved. The solution is that the build image command needs to be run in the project solution directory – user21335192 Mar 23 '23 at 13:40