Hi there
In my Visual Studio 2019 I have a solution with 2 projects
- CIT Web Service (just a .NET5 Web API)
- DTOClasses (just a ClassLibrary, POCO classes)
Project 1 has a reference to Project 2. Project 1 is dockerized. When publish Project 1 to Docker Hub, it fails with the message:
COPY failed: failed to resolve scoped path …\DTOClasses\DTOClasses.csproj (): evalSymlinksInScope: \?\C:\ProgramData\Docker\tmp\DTOClasses\DTOClasses.csproj is not in \?\C:\ProgramData\Docker\tmp\docker-builder196013785. Possible cause is a forbidden path outside the build context
The Project 1 Dockerfile is as following:
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["CIT Web Service/CIT Web Service.csproj", "CIT Web Service/"]
COPY ["../DTOClasses/DTOClasses.csproj", "../DTOClasses/"]
RUN dotnet restore "CIT Web Service/CIT Web Service.csproj"
COPY . .
WORKDIR "/src/CIT Web Service"
RUN dotnet build "CIT Web Service.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "CIT Web Service.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "CIT Web Service.dll"]
What can cause the problem?
Thanks