简体   繁体   中英

Unable to built docker C# for Azure Edge , ERROR [build-env 6/6] RUN dotnet publish -c Release -o out

I was trying to build an Azure Edge Solution on C#, but it was falling, I have installed the don't 2.1 Runtime and SDK, here are the output of that

dotnet --list-sdks 
2.1.812 [/usr/local/share/dotnet/sdk]

dotnet --list-runtimes                                 
Microsoft.AspNetCore.All 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.24 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

I have checked in the project there is double.sln or.csproj files在此处输入图像描述

here are the logs:

[+] Building 3.7s (16/16) FINISHED                                                                                                                                                            
 => [internal] load build definition from Dockerfile.amd64                                                                                                                               0.0s
 => => transferring dockerfile: 126B                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/microsoft/dotnet:2.1-runtime-stretch-slim                                                                                                     2.8s
 => [internal] load metadata for docker.io/microsoft/dotnet:2.1-sdk                                                                                                                      3.6s
 => [stage-1 1/4] FROM docker.io/microsoft/dotnet:2.1-runtime-stretch-slim@sha256:533af29cad1c859841fc5e93bf73011afcd9e3186146f1bb1365a91f2c29e85e                                       0.0s
 => [internal] load build context                                                                                                                                                        0.0s
 => => transferring context: 3.36kB                                                                                                                                                      0.0s
 => [build-env 1/6] FROM docker.io/microsoft/dotnet:2.1-sdk@sha256:d11699f356ee5f0d199526a7eded1c4827ea71b8378cdbe421ed4575a2b1caa8                                                      0.0s
 => CACHED [stage-1 2/4] WORKDIR /app                                                                                                                                                    0.0s
 => CACHED [build-env 2/6] WORKDIR /app                                                                                                                                                  0.0s
 => CACHED [build-env 3/6] COPY *.csproj ./                                                                                                                                              0.0s
 => CACHED [build-env 4/6] RUN dotnet restore                                                                                                                                            0.0s
 => CACHED [build-env 5/6] COPY . ./                                                                                                                                                     0.0s
 => CACHED [build-env 6/6] RUN dotnet publish -c Release -o out                                                                                                                          0.0s
 => CACHED [stage-1 3/4] COPY --from=build-env /app/out ./                                                                                                                               0.0s
 => CACHED [stage-1 4/4] RUN useradd -ms /bin/bash moduleuser                                                                                                                            0.0s
 => exporting to image                                                                                                                                                                   0.0s
 => => exporting layers                                                                                                                                                                  0.0s
 => => writing image sha256:50183243f43214b5a9c9251bd3f349244d9171113cc27b2801ebae25935cb7c0                                                                                             0.0s
 => => naming to draftfoxcontainerdev2.azurecr.io/v2/linux/parsermodule:0.0.1-amd64                                                                                                      0.0s
[+] Building 1.2s (12/15)                                                                                                                                                                     
 => [internal] load build definition from Dockerfile.amd64                                                                                                                               0.0s
 => => transferring dockerfile: 126B                                                                                                                                                     0.0s
 => [internal] load .dockerignore                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/microsoft/dotnet:2.1-runtime-stretch-slim                                                                                                     0.5s
 => [internal] load metadata for docker.io/microsoft/dotnet:2.1-sdk                                                                                                                      0.3s
 => [internal] load build context                                                                                                                                                        0.0s
 => => transferring context: 2.92kB                                                                                                                                                      0.0s
 => [stage-1 1/4] FROM docker.io/microsoft/dotnet:2.1-runtime-stretch-slim@sha256:533af29cad1c859841fc5e93bf73011afcd9e3186146f1bb1365a91f2c29e85e                                       0.0s
 => [build-env 1/6] FROM docker.io/microsoft/dotnet:2.1-sdk@sha256:d11699f356ee5f0d199526a7eded1c4827ea71b8378cdbe421ed4575a2b1caa8                                                      0.0s
 => CACHED [build-env 2/6] WORKDIR /app                                                                                                                                                  0.0s
 => CACHED [build-env 3/6] COPY *.csproj ./                                                                                                                                              0.0s
 => CACHED [build-env 4/6] RUN dotnet restore                                                                                                                                            0.0s
 => CACHED [build-env 5/6] COPY . ./                                                                                                                                                     0.0s
 => ERROR [build-env 6/6] RUN dotnet publish -c Release -o out                                                                                                                           0.6s
------                                                                                                                                                                                        
 > [build-env 6/6] RUN dotnet publish -c Release -o out:                                                                                                                                      
#13 0.557 Microsoft (R) Build Engine version 16.2.37902+b5aaefc9f for .NET Core
#13 0.557 Copyright (C) Microsoft Corporation. All rights reserved.
#13 0.557 
#13 0.562 MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file.
------
executor failed running [/bin/sh -c dotnet publish -c Release -o out]: exit code: 1
arnab.h.ghosh@AMAC02X335VJG5M edgesolution %     

I tested with a new sample c# image that is getting built without any problem

 => [internal] load build definition from Dockerfile.amd64                                                                0.0s
 => => transferring dockerfile: 43B                                                                                       0.0s
 => [internal] load .dockerignore                                                                                         0.0s
 => => transferring context: 34B                                                                                          0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim                                    0.5s
 => [internal] load metadata for mcr.microsoft.com/dotnet/core/sdk:3.1-buster                                             0.5s
 => [build-env 1/6] FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster@sha256:0fece15a102530aa2dad9d247bc0d05db6790917696  0.0s
 => [stage-1 1/4] FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim@sha256:6c67bed8a41e4cadb44303d509f4df707ff4  0.0s
 => [internal] load build context                                                                                         0.0s
 => => transferring context: 1.73kB                                                                                       0.0s
 => CACHED [build-env 2/6] WORKDIR /app                                                                                   0.0s
 => [build-env 3/6] COPY *.csproj ./                                                                                      0.0s
 => [build-env 4/6] RUN dotnet restore                                                                                   15.5s
 => [build-env 5/6] COPY . ./                                                                                             0.0s 
 => [build-env 6/6] RUN dotnet publish -c Release -o out                                                                  3.6s 
 => CACHED [stage-1 2/4] WORKDIR /app                                                                                     0.0s
 => [stage-1 3/4] COPY --from=build-env /app/out ./                                                                       0.1s
 => [stage-1 4/4] RUN useradd -ms /bin/bash moduleuser                                                                    0.3s 
 => exporting to image                                                                                                    0.0s 
 => => exporting layers                                                                                                   0.0s 
 => => writing image sha256:b6c94d4a3a011c0e5e596a25662b8a5e84d47253f3ed3bf2c8b0c6743331291f                              0.0s
 => => naming to localhost:5000/samplemodule:0.0.1-amd64   

As your logs state, you have multiple project or solution files and should specify one or get rid of one.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM