Forum Discussion
sanjeevshrestha
Jan 12, 2023Copper Contributor
DotNetCoreCLI@2 (dotnet publish) doesn't publish webapi project
I have a solution with .net core mvc and webapi projects. While publishing this project in build pipeline in azure-devops it publishes mvc code in zip folder but it doesn't publish webapi project code.
here is my publish task:
variables:
buildConfiguration: 'Release'
solution: '**/*.sln'
artifactName: 'drop'
jobs:
- job: Build
steps:
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: $(solution)
- task: DotNetCoreCLI@2
displayName: 'Dotnet Build'
inputs:
projects: $(solution)
command: 'build'
arguments: '--configuration $(buildConfiguration)'
# Publish projects to specified folder.
- task: DotNetCoreCLI@2
displayName: 'Dotnet Publish'
inputs:
command: 'publish'
publishWebProjects: true
projects: $(solution)
arguments: '-o $(Build.ArtifactStagingDirectory)'
The webapi project doesn't have web.config or wwwroot but does use Microsoft.NET.Sdk.Web and based on the documentation, it should be able to identify that as web project.
Any idea why webapi project is not getting published?
Sanjeev
No RepliesBe the first to reply