How to dockerize an ASP.NET Core 2.0 application? : <p>I have a simple ASP.NET Core 2.0 application with 2 projects in a solution. One project is a class library (WorldLibrary.dll), which is referenced by the web application (WeatherWeb.dll).</p>

<p>I have tried to follow the steps here:</p>

<p><a href="https://docs.docker.com/engine/examples/dotnetcore/" rel="noreferrer">https://docs.docker.com/engine/examples/dotnetcore/</a></p>

<p>This is my Dockerfile:</p>

<pre><code>FROM microsoft/aspnetcore-build:2.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/aspnetcore:2.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "WeatherWeb.dll"]
</code></pre>

<p>But, there is a problem with the referenced .dll. I get the following output from the "docker build" command:</p>

<pre><code>C:\Users\olavt\source\repos\Weather\WeatherWeb&gt;docker build -t weather .
Sending build context to Docker daemon  6.398MB
Step 1/10 : FROM microsoft/aspnetcore-build:2.0 AS build-env
 ---&gt; df4c9af52c86
Step 2/10 : WORKDIR /app
 ---&gt; Using cache
 ---&gt; ae9d1b099da7
Step 3/10 : COPY *.csproj ./
 ---&gt; Using cache
 ---&gt; 2d9f3fba6470
Step 4/10 : RUN dotnet restore
 ---&gt; Using cache
 ---&gt; 19af5fb355a3
Step 5/10 : COPY . ./
 ---&gt; 1704520a3ced
Step 6/10 : RUN dotnet publish -c Release -o out
 ---&gt; Running in 7bcdf847e4dc
/usr/share/dotnet/sdk/2.0.2/NuGet.targets(792,5): warning MSB3202: The project file "/WorldLibrary/WorldLibrary.csproj" was not found. [/app/WeatherWeb.csproj]
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

/usr/share/dotnet/sdk/2.0.2/Microsoft.Common.CurrentVersion.targets(1768,5): warning : The referenced project '../WorldLibrary/WorldLibrary.csproj' does not exist. [/app/WeatherWeb.csproj]
Controllers/Api/WeatherController.cs(6,7): error CS0246: The type or namespace name 'WorldLibrary' could not be found (are you missing a using directive or an assembly reference?) [/app/WeatherWeb.csproj]
Controllers/WeatherController.cs(6,7): error CS0246: The type or namespace name 'WorldLibrary' could not be found (are you missing a using directive or an assembly reference?) [/app/WeatherWeb.csproj]
Controllers/Api/WeatherController.cs(14,39): error CS0246: The type or namespace name 'Weather' could not be found (are you missing a using directive or an assembly reference?) [/app/WeatherWeb.csproj]
The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1

C:\Users\olavt\source\repos\Weather\WeatherWeb&gt;
</code></pre>

<p>How should I properly get the referenced .dll copied over correctly?</p>
