title: ASP.NET Core build docker image having shared libraries
body: <p>I'm working in a microservice environemnt where there are shared libraries between these microservices.</p>
  <p>These libraries are stored in a different location on the disk, a &quot;shared&quot; location, and are directly referenced by these microservices.</p>
  <p>In a .csproj of such a microservice you would see something like this.</p>
  <pre><code>&lt;ItemGroup&gt;
     &lt;ProjectReference Include=&quot;..\..\..\Shared1.csproj&quot; /&gt;
  &lt;ItemGropu&gt;
  </code></pre>
  <p>Now in each of these microservices I have a dockerfile</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
  WORKDIR /app
  EXPOSE 80
  
  FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
  WORKDIR /src
  COPY . .
  COPY ../../../Users/boris/Desktop/shared/Shared/Shared/Shared.csproj .
  RUN dotnet restore &quot;WebUi.csproj&quot;
  
  WORKDIR /src/.
  RUN dotnet build &quot;WebUi.csproj&quot; -c Release -o /app/build
  
  FROM build AS publish
  RUN dotnet publish &quot;WebUi.csproj&quot; -c Release -o /app/publish
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app/publish .
  RUN ls
  ENTRYPOINT [&quot;dotnet&quot;, &quot;WebUi.dll&quot;]
  </code></pre>
  <p>when building a image</p>
  <pre><code>docker build -f dockerfile .
  </code></pre>
  <p>I'm getting</p>
  <blockquote>
  <p>ERROR [build 4/7] COPY ..\..\..\Users\boris\Desktop\shared\Shared\Shared\Shared.csproj .</p>
  <p>[build 4/7] COPY
  ......\Users\boris\Desktop\shared\Shared\Shared\Shared.csproj .:
  failed to solve with frontend dockerfile.v0: failed to build LLB:
  failed to compute cache key:
  &quot;/..\..\..\Users\boris\Desktop\shared\Shared\Shared\Shared.csproj&quot;
  not found: not found PS C:.demos\hangfire-dashboard\WebUi&gt; docker
  build -f .\dockerfile -t web . [+] Building 0.2s (10/18)</p>
  </blockquote>
  <p>I'm thinking it's because of the build context, but not sure.</p>
  <p>Any ideas on how can I fix this ?</p>