gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 18:07:58 74 4
gpt4 key购买 nike

我是Docker的新手,正在尝试为ASP.NET Core应用程序创建Dockerfile。有人可以建议我需要哪些更改吗?

这是我的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"]

我面临以下错误:

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

最佳答案

您的工作目录似乎包含.csproj和.sln文件。尝试在命令中指定.sln文件。
运行

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

我在dotnet build上遇到了相同的错误消息,这可以解决它。

顺便说一句,由于.NET Core 2.0,dotnet restore命令是隐式运行的,因此您可以跳过它。

关于asp.net - MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57225921/

74 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com