azure devops pipeline program does not contain a static ‘main’ method suitable for an entry point

After scratching my head for a while, basically going through each line in the pipeline, I was able to fix this problem. It was an issue with the build directory. Instead of arguments: --output $(System.DefaultWorkingDirectory) --configuration $(buildConfiguration), I had to use arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration $(buildConfiguration) so that the final output will be saved inside the publish_output folder.

stages:
- stage: Build
  displayName: Build stage

  jobs:
  - job: Build
    displayName: Build
    condition: ne(variables['Build.Reason'], 'PullRequest')
    pool:
      vmImage: $(vmImageName)

    steps:
    - task: [email protected]
      displayName: Build
      inputs:
        command: 'build'
        arguments: --output $(System.DefaultWorkingDirectory)/publish_output --configuration $(buildConfiguration)
    - task: [email protected]
      inputs:
        command: publish
        publishWebProjects: true
        arguments: '--configuration $(BuildConfiguration) --output $(Build.ArtifactsStagingDirectory)/$(Build.BuildId).zip'
        zipAfterPublish: true
    - task: [email protected]
      inputs:
        PathtoPublish: $(Build.ArtifactsStagingDirectory)/$(Build.BuildId).zip
        ArtifactName: drop

After this change, my pipeline was successful.

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top