Alvaro
Alvaro

Reputation: 51

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

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 a 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 file?

Upvotes: 1

Views: 326

Answers (0)

Related Questions