MSBUILD Specify a project or solution file. The current working directory does not contain a project or solution file

Viewed 56

I'm building a small console application in .NET core and I wanted to build and a docker image

This is my project structure

enter image description here

So I have created Docker file like below

# Set base image
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build-env


# Set working directory
WORKDIR /app

# Copy csproj and restore dependencies
COPY  *.csproj ./
RUN dotnet restore

# Copy project files 
COPY . ./


# Publish the application  
RUN dotnet publish -c Release -o out

# Generate runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim
WORKDIR /app
EXPOSE 80
COPY --from=build-env /app/out .
CMD ["dotnet", "ConsoleUI.dll"]

So once I tried to build the image I got this error

 > [build-env 4/6] RUN dotnet restore:
#11 4.432 MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

Why is this happening if I copied the csproj

0 Answers
Related