Исключение «ошибка MSB3024: не удалось скопировать файл ...» выдается при попытке встроить конвейер DevOps с помощью .Net Core 3.0 SDK (preview5) - PullRequest
2 голосов
/ 24 мая 2019

Я пытаюсь собрать проект .Net Core 3.0 (предварительный просмотр) в конвейере сборки DevOps.

Шаги в моем azure-pipelines.yml выполняются вплоть до шага "сборки докера", успешно инициируяпроцесс сборки.Файл Docker считывается и выполняется до шага «сборки dotnet», после которого выдается следующая ошибка.

ошибка MSB3024: не удалось скопировать файл "/ src / obj / Release / netcoreapp3.0 / "к файлу назначения" / app / ", потому что местом назначения является папка, а не файл.Чтобы скопировать исходный файл в папку, рассмотрите возможность использования параметра DestinationFolder вместо DestinationFiles.[/src/.csproj]

Я попытался выполнить локальную сборку, выполнив сборку dotnet ".csproj" -c Release -o / app. Затем сборка завершается успешно с 0 ошибками и 0 предупреждениями.Может ли это быть связано с проблемой SDK в DevOps?

Буду признателен за любой совет.

Команда построения из моего файла Docker.

RUN dotnet build "<project>.csproj" -c Release -o /app
..... --Ommitted 
 ---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

1 Ответ

1 голос
/ 30 мая 2019

Я предполагаю, что это проблема с .Net Core 3.0 preview5 SDK. Я создал проект в .Net Core 2.2 и он успешно собран.

...