ERROR[build 6/6]运行dotnet Publish“” -c Release -o/app/Publish

问题描述 投票:0回答:1
D:\Working\Phong_Nguyen_Super_Hero\Weather Forecast Application\WeatherForecast-main\TLY.WeatherForecast |- TLY.WeatherForecast.sln |- Dockerfile |- .dockerignore |- TLY.WeatherForecast

我的dockerfile内容看起来像

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base WORKDIR /app EXPOSE 80 ENV ASPNETCORE_URLS=http://+:80 FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build WORKDIR /src COPY ["TLY.WeatherForecast/TLY.WeatherForecast.csproj", "TLY.WeatherForecast/"] RUN dotnet restore "TLY.WeatherForecast/TLY.WeatherForecast.csproj" COPY . . RUN dotnet publish "TLY.WeatherForecast.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=build /app/publish . ENTRYPOINT ["dotnet", "TLY.WeatherForecast.dll"]

当我运行此命令

docker build -t phongnguyen94/weatherforecast_api:latest .

我的错误低于

> [+] Building 110.7s (14/15) => [internal] load build definition from > Dockerfile => transferring dockerfile: 569B => [internal] load .dockerignore => transferring context: 388B => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:5.0 => [internal] load build context => transferring context: 4.46MB => [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:5.0@sha256:c0cc95b0d87a31401763f8c7b2a25aa106e7b45bfcaa2f302dc9d0ff5ab93fa2 => => resolve mcr.microsoft.com/dotnet/aspnet:5.0@sha256:c0cc95b0d87a31401763f8c7b2a25aa106e7b45bfcaa2f302dc9d0ff5ab93fa2 => extracting sha256:1396b16d0d87d441988017c78df3fe711ae12f60cce661c2a9a004bdce6f4ee3 => [build 1/6] FROM mcr.microsoft.com/dotnet/sdk:5.0@sha256:85ea9832ae26c70618418cf7c699186776ad066d88770fd6fd1edea9b260379a => resolve mcr.microsoft.com/dotnet/sdk:5.0@sha256:85ea9832ae26c70618418cf7c699186776ad066d88770fd6fd1edea9b260379a => extracting sha256:9887694812e570c8e6fab2fbffd327127283e4360cce25677d9ee7a7c309162d => [base 2/2] WORKDIR /app => [final 1/2] WORKDIR /app => [build 2/6] WORKDIR /src => [build 3/6] COPY [TLY.WeatherForecast/TLY.WeatherForecast.csproj, TLY.WeatherForecast/] => [build 4/6] RUN dotnet restore "TLY.WeatherForecast/TLY.WeatherForecast.csproj" => [build 5/6] COPY . . => ERROR [build 6/6] RUN dotnet publish "TLY.WeatherForecast.csproj" -c Release -o /app/publish ------ > [build 6/6] RUN dotnet publish "TLY.WeatherForecast.csproj" -c Release -o /app/publish: #14 0.578 Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET #14 0.578 Copyright (C) Microsoft Corporation. All rights reserved. #14 0.578 #14 0.579 MSBUILD : error MSB1009: Project file does not exist. #14 0.579 Switch: TLY.WeatherForecast.csproj

	
我已经更改了

Dockerfile

内容,然后它的工作正常
from
docker docker-compose dockerfile
1个回答
0
投票

to

RUN dotnet publish "TLY.WeatherForecast/TLY.WeatherForecast.csproj" -c Release -o /app/publish

由于我已经将

Dockerfile
文件放在项目之外。因此,我需要重定向到
TLY.WeatherForecast

文件夹。

    
在我的身边,问题是我在内部.NET环境中运行Angular,并且发布失败了,因为我已经旧的NG软件包了,因此我不得不更新更新我的.csproj文件,在此处安装了NPM,请添加 - 添加 - 传统peer-deps

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.