Ich habe ein Problem mit meinem Projekt zusammen mit Docker.root/
---docker/
------compose.yaml
---src/
------BusinessPlanner.Extensions
---------BusinessPlanner.Extensions.csproj
------Users/
---------Users.csproj
---------Dockerfile
< /code>
my compose.yaml sieht so aus: < /p>
user-db:
image: postgres:latest
environment:
POSTGRES_DB: users
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
DB_HOST: 127.0.0.1
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
user-app:
build:
context: ../
dockerfile: src/Users/Dockerfile
environment:
ASPNETCORE_ENVIRONMENT: Release
image: "users"
ports:
- "8080:8080"
depends_on:
- user-db
volumes:
pgdata:
driver: local
< /code>
Meine Dockerfile sieht so aus: < /p>
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base
USER $APP_UID
WORKDIR /app
EXPOSE 8080
EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/BusinessPlanner.Extensions/BusinessPlanner.Extensions.csproj", "BusinessPlanner.Extensions/"]
COPY ["src/Users/Users.csproj", "Users/"]
RUN dotnet restore "Users/Users.csproj"
COPY . .
WORKDIR "Users/"
RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Users.dll"]
< /code>
Beim Ausführen des Befehls "Docker Compose Build" aus dem Docker -Ordner erhalte ich diesen Fehler:
=> Fehler [Build 8/8] DOTNE -Build ausführen "user.csproj "-c Release -o/App/Build
CSC: Fehler CS5001: Das Programm enthält keine statische" Hauptmethode "für einen Einstiegspunkt [/src
/users/users.csproj weibliche; p>
Die Benutzer.csproj ist ein Webapi, das ohne Probleme mit Dotnet -Lauf ausgeführt werden kann. Startet die Datenbank und die Webapi.
Was fehlt mir?
Ich habe ein Problem mit meinem Projekt zusammen mit Docker.root/ ---docker/ ------compose.yaml ---src/ ------BusinessPlanner.Extensions ---------BusinessPlanner.Extensions.csproj ------Users/ ---------Users.csproj ---------Dockerfile < /code> my compose.yaml sieht so aus: < /p> user-db: image: postgres:latest environment: POSTGRES_DB: users POSTGRES_USER: myuser POSTGRES_PASSWORD: mypassword DB_HOST: 127.0.0.1 ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data user-app: build: context: ../ dockerfile: src/Users/Dockerfile environment: ASPNETCORE_ENVIRONMENT: Release image: "users" ports: - "8080:8080" depends_on: - user-db
volumes: pgdata: driver: local < /code> Meine Dockerfile sieht so aus: < /p> FROM mcr.microsoft.com/dotnet/sdk:8.0 AS base USER $APP_UID WORKDIR /app EXPOSE 8080 EXPOSE 8081
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["src/BusinessPlanner.Extensions/BusinessPlanner.Extensions.csproj", "BusinessPlanner.Extensions/"] COPY ["src/Users/Users.csproj", "Users/"] RUN dotnet restore "Users/Users.csproj" COPY . . WORKDIR "Users/" RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish ARG BUILD_CONFIGURATION=Release RUN dotnet build "Users.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "Users.dll"] < /code> Beim Ausführen des Befehls "Docker Compose Build" aus dem Docker -Ordner erhalte ich diesen Fehler: => Fehler [Build 8/8] DOTNE -Build ausführen "user.csproj "-c Release -o/App/Build CSC: Fehler CS5001: Das Programm enthält keine statische" Hauptmethode "für einen Einstiegspunkt [/src /users/users.csproj weibliche; p> Die Benutzer.csproj ist ein Webapi, das ohne Probleme mit Dotnet -Lauf ausgeführt werden kann. Startet die Datenbank und die Webapi. Was fehlt mir?
Ich versuche, ein ASP.NET -Kern -Web -API -Projekt in meinem Linux -System (Ubuntu 22.04) zu erstellen und mit dem Befehl dotnet restore oder dotnet New ein Problem zu stellen: Der Prozess bleibt...
Ich sende Formulardaten über Angular an C# Core -Web -API. Die Konsole zeigt die Daten, die per Dienst an die API gesendet werden. Ich versuche einen Wert zu aktualisieren. Wenn Debugger jedoch am...
Ich habe eine C# ASP.NET -Webapi -Anwendung, wobei die API -Dokumentation mithilfe von swashbuckle automatisch generiert wird. Ich möchte in der Lage sein, bestimmte Methoden aus der Dokumentation...
Ich teste diesen Blazor-Server auf unserem vorhandenen ASP.NET Core MVC-Projekt mit der neuesten Version von .NET 8.
Beim Ausführen tritt immer dieser Fehler auf:
Die Anfrage stimmte mit mehreren...