Partage
  • Partager sur Facebook
  • Partager sur Twitter

Projet ASP dans Docker

    10 août 2021 à 10:43:09

    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):

    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 :

    => 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/MonProjet/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/MonProjet/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

    • Partager sur Facebook
    • Partager sur Twitter
      1 septembre 2021 à 10:52:33

      le message d'erreur me semble assez clair : "Program does not contain a static 'Main' method suitable for an entry point"

      il ne trouve pas de fonction Main statique.

      https://docs.microsoft.com/fr-fr/dotnet/csharp/misc/cs5001 

      • Partager sur Facebook
      • Partager sur Twitter

      Projet ASP dans Docker

      × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
      × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
      • Editeur
      • Markdown