将 #Aspire 添加到我的项目后,我需要将工作负载添加到 Azure 托管代理。最初,根据文档我添加了以下内容:
- task: DotNetCoreCLI@2
displayName: "dotnet workload restore"
# dotnet workload restore [<PROJECT | SOLUTION>...] [options]
inputs:
command: 'custom'
custom: 'workload restore'
projects: '$(solution)'
结果:
Starting: dotnet workload restore
==============================================================================
Task : .NET Core
Description : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version : 2.240.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.
/usr/bin/dotnet workload restore /home/vsts/work/1/s/Solution.sln
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-workload restore does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
##[error]Error: The process '/usr/bin/dotnet' failed with exit code 1
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : [ '/home/vsts/work/1/s/Solution.sln' ]
Finishing: dotnet workload restore
我尝试过其他一些变体,但似乎都不起作用。有没有办法让它使用
DotNetCoreCLI@2
任务工作?
目前恢复使用:
- task: CmdLine@2
displayName: "dotnet workload restore"
inputs:
script: 'dotnet workload restore'