无法在Azure DevOps构建管道中使用.NET SDK代理
我有一个ASP.NET Core 2.1,并添加了一个Microsoft.WindowsAzure.Storage的nuget包,但是在推送代码回购后,运行构建代理时,构建管道会发生包错误,是否有必要添加其他任何内容构建管道中的代理(构建,还原,测试和发布除外).
I have a ASP.NET Core 2.1 and added a nuget package of Microsoft.WindowsAzure.Storage , But after pushing the code to repo, the build pipeline occurs package error while running the build agent and is it necessary to add any other agents in build pipeline other than BUILD, RESTORE, TEST and PUBLISH.
信息:Azure Pipelines托管代理已更新为包含.Net Core 3.x SDK/Runtime以及2.2& 2.1.除非您为项目锁定了一个SDK版本,否则可能会选择3.x SDK,该SDK与以前的版本相比可能具有破坏性的行为.
Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x SDK/Runtime along with 2.2 & 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions.
这是运行管道时显示的错误.
This is the error it shows while running the pipeline.
如错误信息所示,不建议调用latest 3.x sdk
来还原,构建,测试和发布针对asp .net core 2.1
的项目.
As the error info indicates, it's not recommended to call latest 3.x sdk
to restore,build,test,publish your project that targets asp .net core 2.1
.
尽管在大多数情况下,构建可以通过,但是发布"步骤(任务)可能会遇到此问题:
Though in most of time the build can pass, but the Publish step(task) may encounter this issue:
要解决此问题,请执行以下操作:
在运行诸如restore,build,test,publish
...
我们可以添加先使用.net核心sdk任务,然后再使用诸如此类的.net核心任务来获取与.net core 2.1.x
相关的版本,以执行以下任务,而不是使用.net core 3.x sdk
:
We could add a use .net core sdk task before other .net core tasks like this to pick up the .net core 2.1.x
related version to do the following tasks instead of using .net core 3.x sdk
:
经典界面:
指定2.1.x+Include Preview Versions
将获取2.1 sdk的最新版本.
Specify 2.1.x+Include Preview Versions
will pick up the latest version of 2.1 sdk.
Yaml:
如果您使用的是yaml格式而不是经典的UI格式来配置管道,则其yaml格式类似于以下内容:
In case you're using yaml format instead of classic UI format to configure the pipeline, its yaml format looks similar to this:
steps:
- task: UseDotNet@2
displayName: 'Use .Net Core sdk 2.1.x'
inputs:
packageType: sdk
version: 2.1.x
installationPath: $(Agent.ToolsDirectory)/dotnet
includePreviewVersions: true
希望它会帮助我,如果我误解了什么,可以随时纠正我:)
Hope it helps and feel free to correct me if I misunderstand anything:)