This is part of my .yml file:
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'
I'm trying to publish a .NET6 API project. I can see the artifact published, but it's not in .zip format.
I have tried changing the publishWebProjects
to true and false, no effect.
Here's the logs:
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
What am I doing wrong here?
CodePudding user response:
The correct input for the task "DotNetCoreCLI@2" is:
command: publish
instead of commands: publish