Azure DevOps任务DotNetCoreCLI@2未将我的Web API项目发布为.zip

at0kjp5o  于 2023-01-09  发布在  其他
关注(0)|答案(1)|浏览(110)

这是我的.yml文件的一部分:

pool:
  vmImage: 'ubuntu-latest'

- task: DotNetCoreCLI@2
  inputs:
    commands: publish
    publishWebProjects: true
    arguments: '-c Release -r linux-x64 --no-self-contained --output $(Build.ArtifactStagingDirectory) .\src\BasicDemoApi\BasicDemoApi.csproj'
    zipAfterPublish: true
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'

我正在尝试发布一个.NET6 API项目。我可以看到发布的工件,但它不是.zip格式。
我试过将publishWebProjects更改为true和false,没有效果。
以下是日志:

Starting: DotNetCoreCLI
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.210.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 build -dl:CentralLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.210.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"/home/vsts/work/_tasks/DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b/2.210.0/dotnet-build-helpers/Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" -c Release -r linux-x64 --no-self-contained --output /home/vsts/work/1/a .\src\BasicDemoApi\BasicDemoApi.csproj
MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
  Restored /home/vsts/work/1/s/src/BasicDemoApi/BasicDemoApi.csproj (in 336 ms).
##[warning]src/BasicDemoApi/Data/CommandContext.cs(8,12): Warning CS8618: Non-nullable property 'CommandItems' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
/home/vsts/work/1/s/src/BasicDemoApi/Data/CommandContext.cs(8,12): warning CS8618: Non-nullable property 'CommandItems' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/home/vsts/work/1/s/src/BasicDemoApi/BasicDemoApi.csproj]
##[warning]src/BasicDemoApi/Data/SqlCommandApiRepo.cs(33,16): Warning CS8603: Possible null reference return.
/home/vsts/work/1/s/src/BasicDemoApi/Data/SqlCommandApiRepo.cs(33,16): warning CS8603: Possible null reference return. [/home/vsts/work/1/s/src/BasicDemoApi/BasicDemoApi.csproj]
  BasicDemoApi -> /home/vsts/work/1/a/BasicDemoApi.dll

Build succeeded.

/home/vsts/work/1/s/src/BasicDemoApi/Data/CommandContext.cs(8,12): warning CS8618: Non-nullable property 'CommandItems' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [/home/vsts/work/1/s/src/BasicDemoApi/BasicDemoApi.csproj]
/home/vsts/work/1/s/src/BasicDemoApi/Data/SqlCommandApiRepo.cs(33,16): warning CS8603: Possible null reference return. [/home/vsts/work/1/s/src/BasicDemoApi/BasicDemoApi.csproj]
    2 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.71
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
Finishing: DotNetCoreCLI

我到底做错了什么?

t98cgbkg

t98cgbkg1#

任务“DotNetCoreCLI@2”的正确输入为:

command: publish

代替命令s:出版

相关问题