Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file

Tags:

docker

asp.net

I am new to docker and trying to create a Dockerfile for ASP.NET Core application. Can someone suggest what changes do I require?

Here is my Dockerfile:

FROM microsoft/dotnet:2.1-sdk  
WORKDIR /app  
COPY Presentation/ECCP.Web/ *.csproj ./  
RUN dotnet restore  
COPY . ./  
RUN dotnet publish -c Release -o out  

FROM microsoft/aspnetcore:2.0  
WORKDIR /app  
COPY --from=build-env /app/out .  
ENTRYPOINT ["dotnet", "api.dll"]  

I am facing the following error:

MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file. The command '/bin/sh -c dotnet publish -c Release -o out' returned a non-zero code: 1

like image 413
pj0402 Avatar asked Jul 26 '19 19:07

pj0402


1 Answers

It looks like your work dirctory contains both .csproj and .sln files. Try to specify the .sln file in the command. Run

dotnet publish your-solution-file.sln -c Release -o out

I had the same error message with dotnet build and this solves it.

By the way, since .NET Core 2.0 the dotnet restore command is run implicitly, so you may skip it.

like image 136
fandasson Avatar answered Sep 19 '22 21:09

fandasson