Not able to publish Azure Function properly using Azure Devops CI/CD pipeline

manikanta puppala 1 Reputation point
2022-03-23T16:01:48.31+00:00

My Solution looks like below,

186203-image.png

yaml file for CI,

ASP.NET Core

Build and test ASP.NET Core projects targeting .NET Core.

Add steps that run tests, create a NuGet package, deploy, and more:

https://learn.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:

  • master

pool: 'Default'

variables:
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'

steps:

  • task: NuGetToolInstaller@1
  • task: NuGetCommand@2
    inputs:
    command: 'restore'
    restoreSolution: '$(solution)'
    feedsToUse: 'select'
  • task: DotNetCoreCLI@2
    inputs:
    command: 'build'
    projects: '**/TestAzureFunc.csproj'
    arguments: --configuration $(BuildConfiguration)'
  • task: DotNetCoreCLI@2
    displayName: Runing Unit Tests
    inputs:
    command: test
    projects: '**/Tests.csproj'
    arguments: '--configuration $(buildConfiguration)'
  • task: DotNetCoreCLI@2
    displayName: Publish
    inputs:
    command: publish
    publishWebProjects: false
    arguments: '--configuration $(BuildConfiguration) --self-contained false --output $(build.artifactstagingdirectory)'
    zipAfterPublish: true
  • task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact'
    inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
    ArtifactName: 'drop'

Artifacts Folder looks like below for the above YAML file

186120-image.png

It supposes to generate the files like below ( the below files I published from the visual studio)

186140-image.png

I don't know what I'm missing in the pipe it generating some extra files, Could someone help with this, please?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,382 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,441 Reputation points
    2022-03-24T10:54:24.57+00:00

    @manikanta puppala ,

    Thanks for reaching out to Q&A.

    The documentation you are refering is for .net core apps. We have a specific task available in Azure devops for .net core based Azure functions. Please refer the below article for reference.

    https://learn.microsoft.com/en-us/azure/azure-functions/functions-how-to-azure-devops?view=azure-devops&tabs=dotnet-core%2Cyaml%2Ccsharp

    I hope this helps! Feel free to reach out to me if you have any questions or concerns.

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.