【发布时间】:2019-09-02 08:56:11
【问题描述】:
我正在使用一个任务组在 Azure DevOps 中为 AspNet Core Web Api 创建一个构建管道,该任务组首先安装 .Net Core SDK (2.2),然后使用 dotnet restore(使用 VSTS 源)进行包还原然后构建项目。
在构建步骤中,我提供以下参数:
--configuration Release --runtime $(Target Platform) --no-restore /p:Version=$(Major Version).$(Minor Version).$(Build.BuildNumber).
直到build 步骤的所有步骤都成功。但是,我在构建步骤中收到以下错误:
[command]C:\windows\system32\chcp.com 65001
Active code page: 65001
[command]C:\hostedtoolcache\windows\dotnet\dotnet.exe build D:\a\1\s\WebApp\WebApp.csproj --configuration Release --runtime linux-x64 --no-restore /p:Version=1.0.40
Microsoft (R) Build Engine version 16.2.32702+c4012a063 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
C:\hostedtoolcache\windows\dotnet\sdk\2.2.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(208,5): error NETSDK1047: Assets file 'D:\a\1\s\WebApp\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.2/linux-x64'. Ensure that restore has run and that you have included 'netcoreapp2.2' in the TargetFrameworks for your project. You may also need to include 'linux-x64' in your project's RuntimeIdentifiers. [D:\a\1\s\WebApp\WebApp.csproj]
Build FAILED.
C:\hostedtoolcache\windows\dotnet\sdk\2.2.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(208,5): error NETSDK1047: Assets file 'D:\a\1\s\WebApp\obj\project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.2/linux-x64'. Ensure that restore has run and that you have included 'netcoreapp2.2' in the TargetFrameworks for your project. You may also need to include 'linux-x64' in your project's RuntimeIdentifiers. [D:\a\1\s\WebApp\WebApp.csproj]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.53
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : D:\a\1\s\WebApp\WebApp.csproj
##[section]Finishing: Build
我查看了与 Visual Studio 相关的旧答案,但找不到与 Azure DevOps 管道相关的内容。
【问题讨论】:
-
本地我猜没有问题?
-
@ShaykiAbramczyk 是的,本地没问题。
-
在构建之前尝试在本地和管道中运行
dotnet --info,并检查是否存在差异。 -
.Net Core SDK 的补丁版本等存在差异。我应该寻找什么样的差异?
-
如果只是补丁,我认为它应该可以工作。您是否将 obj/bin 文件夹上传到源代码管理?
标签: azure-devops azure-pipelines-release-pipeline nuget-package-restore