Docker Community Forums

Share and learn in the Docker community.

Visual Studio Publish. Cannot build in Docker

Hi there
In Visual Solution I can build my project successfully. Nevertheless, when I start publishing it to a Docker Hub, it throws

NNNN\CIT Web Service\Models\ConfigModel.cs(22,37): error CS0234: The type or namespace name ‘Config’ does not exist in the namespace ‘NNNN.PaymentTransactionEngine’ (are you missing an assembly reference?) [NNNN\CIT Web Service\CIT Web Service.csproj]

My Docker file is as follows:

FROM AS base

FROM AS build
COPY [“CIT Web Service/CIT Web Service.csproj”, “CIT Web Service/”]
RUN dotnet restore “CIT Web Service/CIT Web Service.csproj”
COPY . .
WORKDIR “/src/CIT Web Service”
:nauseated_face: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
COPY --from=publish /app/publish .
ENTRYPOINT [“dotnet”, “CIT Web Service.dll”]

The row, causing the problem, is shown with icon.
What could be a reason for the problem?


It is all about Visual Studio workflow. When create a multi-project solution, make sure you move the .sln file a level up to the parent directory. Only after this, you can add a Docker file to any inner project.