I am trying to build and deploy a .Net 8 Web API using a Github Action that references some other projects in the solution. I am getting the error
“Skipping project
“/src/x.Auth.Application/x.Auth.Application.csproj”
because it was not found.”
Here is my Docker file:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["x.Auth.Api.csproj", "x.Auth.Api/"]
COPY ./nuget.config ./
RUN dotnet restore "./x.Auth.Api/./x.Auth.Api.csproj" --configfile nuget.config
WORKDIR "/src/x.Auth.Api"
COPY . .
RUN dotnet build "./x.Auth.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./x.Auth.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "x.Auth.Api.dll"]
I assume I need to also COPY the reference in the Docker file ie.
COPY ["../x.Auth.Application/x.Auth.Application.csproj", "x.Auth.Api/"]
But when the Docker file is processed, it cannot find the x.Auth.Application.csproj. The folder structure is as follows:
> x
> x.Auth.Application
> x.Auth.Application.csproj
> x.Auth.Api
> x.Auth.Api.csproj
> DockerFile