title: .net core - build error with docker compose
body: <p>I try to create a release build from my backend project with the Visual Studio, but I get the error message </p>
  
  <p><strong>Service 'backend_api' failed to build: The command '/bin/sh -c dotnet build ...</strong></p>
  
  <p>With "docker-compose build" I get the same error.</p>
  
  <p>In Debug-Mode of the Visual Studio it works.</p>
  
  <p><strong>Dockerfile:</strong></p>
  
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
  WORKDIR /app
  EXPOSE 80
  
  FROM mcr.microsoft.com/dotnet/core/sdk:3.0-buster AS build
  WORKDIR /src
  COPY ["backendAPI/backendAPI.csproj", "backendAPI/"]
  RUN dotnet restore "backendAPI/backendAPI.csproj"
  COPY . .
  WORKDIR "/src/backend_API"
  RUN dotnet build "backendAPI.csproj" -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish "backendAPI.csproj" -c Release -o /app/publish
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT ["dotnet", "backendAPI.dll"]
  </code></pre>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>version: '3.7'
  
  services:
    backend_sql:
      image: mcr.microsoft.com/mssql/server:2017-GA-ubuntu
      container_name: testsql
      networks:
        - test_network
      ports:
        - "1440:1433"
      volumes:
       - testsqldata:/var/opt/mssql
  
    backend_api:
      image: ${DOCKER_REGISTRY-}backendapi
      container_name: testapi
      build:
        context: .
        dockerfile: backendAPI/Dockerfile
      networks:
        - test_network
      depends_on:
       - backend_sql
      ports:
       - "5000:80"
  
  networks:
    test_network:
      external:
          name: test_network
  
  volumes:
    testsqldata:
      driver: local
      name: testsqldata
  </code></pre>
  
  <p><strong>Error-Message:</strong></p>
  
  <pre><code>...
  2&gt;Step 7/16 : RUN dotnet restore "backendAPI/backendAPI.csproj"
  2&gt; ---&gt; Running in ee20ee70cedf
  2&gt;  Restore completed in 41.8 sec for /src/backendAPI/backendAPI.csproj.
  2&gt;Removing intermediate container ee20ee70cedf
  2&gt; ---&gt; 6cafbb7f9daf
  2&gt;Step 8/16 : COPY . .
  2&gt; ---&gt; 74dc0dfe8145
  2&gt;Step 9/16 : WORKDIR "/src/backend_API"
  2&gt; ---&gt; Running in e198c3ffb356
  2&gt;Removing intermediate container e198c3ffb356
  2&gt; ---&gt; 114bfbba3151
  2&gt;Step 10/16 : RUN dotnet build "backendAPI.csproj" -c Release -o /app/build
  2&gt; ---&gt; Running in 3e7bf02253ce
  2&gt;Microsoft (R) Build Engine version 16.3.2+e481bbf88 for .NET Core
  2&gt;Copyright (C) Microsoft Corporation. All rights reserved.
  2&gt;MSBUILD : error MSB1009: Project file does not exist.
  2&gt;Switch: backendAPI.csproj
  2&gt;Service 'backend_api' failed to build: The command '/bin/sh -c dotnet build "backendAPI.csproj" -c Release -o /app/build' returned a non-zero code: 1
  2&gt;C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(492,5): error DT1001: Service 'backend_api' failed to build: The command '/bin/sh -c dotnet build "backendAPI.csproj" -c Release -o /app/build' returned a non-zero code: 1
  2&gt;Done building project "docker-compose.dcproj" -- FAILED.
  </code></pre>