gpt4 book ai didi

docker - 尝试使用 .Net Core 3.0 SDK (preview5) 在 DevOps 管道中构建时抛出异常 "error MSB3024: Could not copy the file..."

转载 作者:行者123 更新时间:2023-12-02 11:30:01 26 4
gpt4 key购买 nike

我正在尝试在 DevOps 构建管道中构建一个 .Net Core 3.0 (preview) 项目。

我的 azure-pipelines.yml 中的步骤一直执行到“docker build”步骤,成功启动了构建过程。
Docker 文件被读取并执行到“dotnet build”步骤,之后抛出以下错误。

error MSB3024: Could not copy the file "/src/obj/Release/netcoreapp3.0/" to the destination file "/app/", because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles. [/src/.csproj]



我试图通过执行 dotnet build ".csproj"-c Release -o/app 在本地构建
然后构建成功,出现 0 个错误和 0 个警告。这可能与 DevOps 中的 SDK 问题有关吗?

任何建议将不胜感激。

来自我的 Docker 文件的构建命令。
RUN dotnet build "<project>.csproj" -c Release -o /app
--- {OMITED}
---1ff83de4bdba
Step 5/16 : WORKDIR /src
---Running in 972629766fad
Removing intermediate container 972629766fad
---1325ecd8e7c3
Step 6/16 : COPY ["<projectname>.csproj", "<projectname>/"]
---a4ba463683dc
Step 7/16 : RUN dotnet restore "<projectname>/<projectname>.csproj"
---Running in 82bb9095d412
Restore completed in 14.08 sec for /src/<projectname>/<projectname>.csproj.
Removing intermediate container 82bb9095d412
---7b0cc236782e
Step 8/16 : COPY . .
---884bb695bfb3
Step 9/16 : WORKDIR /src
---Running in 817b001e2060
Removing intermediate container 817b001e2060
---40b8690ecb63
Step 10/16 : RUN dotnet build "<projectname>.csproj" -c Release -o /app
---Running in 48d79b81c3cb
Microsoft (R) Build Engine version 16.0.462+g62fb89029d for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restore completed in 531.02 ms for /src/<projectname>.csproj.
/usr/share/dotnet/sdk/3.0.100-preview5-011568/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(157,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [/src/<projectname>.csproj]
/usr/share/dotnet/sdk/3.0.100-preview5-011568/Microsoft.Common.CurrentVersion.targets(4560,5): error MSB3024: Could not copy the file "/src/obj/Release/netcoreapp3.0/<projectname>" to the destination file "/app/<projectname>", because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles. [/src/<projectname>.csproj]

Build FAILED.

/usr/share/dotnet/sdk/3.0.100-preview5-011568/Microsoft.Common.CurrentVersion.targets(4560,5): **error MSB3024: Could not copy the file "/src/obj/Release/netcoreapp3.0/<projectname>" to the destination file "/app/<projectname>", because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles. **[/src/<projectname>.csproj]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:11.43
The command '/bin/sh -c dotnet build "<projectname>.csproj" -c Release -o /app' returned a non-zero code: 1
##[error]Bash exited with code '1'.
##[section]Finishing: docker build

最佳答案

在我的情况下,我的项目的程序集名称与项目名称相同,也与该项目的目录名称相同。一旦我将项目属性中的程序集名称更改为其他名称,此错误就消失了。

关于docker - 尝试使用 .Net Core 3.0 SDK (preview5) 在 DevOps 管道中构建时抛出异常 "error MSB3024: Could not copy the file...",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56293141/

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