Bonjour,

je suis en train d'installer un projet asp.net dans docker. Cependant, j'ai quelques problèmes lors de la création de l'image Docker.
C'est un projet ASP.net core 5.0. Voici le dockerFile (généré par visual studio):

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["MonProjet.csproj", "MonProjet/"]
RUN dotnet restore "MonProjet/MonProjet.csproj"
COPY . .
WORKDIR "/src/MonProjet"
RUN dotnet build "MonProjet.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "MonProjet.csproj" -c Release -o /app/publish

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

j'obtiens l'erreur suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 => ERROR [build 7/7] RUN dotnet build "MonProjet.csproj" -c Release -o /app/build                                                                                 5.4s 
------
 > [build 7/7] RUN dotnet build "MonProjet.csproj" -c Release -o /app/build:
#15 0.740 Microsoft (R) Build Engine version 16.10.2+857e5a733 for .NET
#15 0.740 Copyright (C) Microsoft Corporation. All rights reserved.
#15 0.740
#15 1.398   Determining projects to restore...
#15 1.825   All projects are up-to-date for restore.
#15 5.343 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/Bamboo/MonProjet.csproj]
#15 5.362
#15 5.362 Build FAILED.
#15 5.362
#15 5.363 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/Bamboo/MonProjet.csproj]
#15 5.363     0 Warning(s)
#15 5.363     1 Error(s)
#15 5.363
#15 5.363 Time Elapsed 00:00:04.52
------
executor failed running [/bin/sh -c dotnet build "MonProjet.csproj" -c Release -o /app/build]: exit code: 1
Auriez vous une solution à ce probleme ?
En sachant qu'il fonctionne parfaitement quand je le lance avec IISExpress