Bob5421
Bob5421

Reputation: 9063

azure devops build and deploy to app service

I have create an empty project on dev.azure.com

I have cloned the repository on my local computer.

I have run this command in the main folder:

$ dotnet new mvc

I have create this azure-pipelines.yml file:

trigger:
- master

pool:
  vmImage: 'windows-latest'

steps:
- task: DotNetCoreCLI@2
  inputs:
    command: 'restore'
    feedsToUse: 'select'
- task: DotNetCoreCLI@2
  inputs:
    command: 'build'
- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: true
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'artifact2'

I have add, commit and pushed files on dev.azure.com (on master branch)

I have this warning message:

##[warning]Directory 'd:\a\1\a' is empty. Nothing will be added to build artifact 'artifact2'.

I have create a release pipeline but i get an error:

##[error]Error: No package found with specified pattern: D:\a\r1\a\**\*.zip<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.

I do not understand what is wrong in my azure-pipelines.yml for artifact production...

Thanks

Upvotes: 0

Views: 182

Answers (1)

Stelios Giakoumidis
Stelios Giakoumidis

Reputation: 2273

It seems that there is an issue where the published dlls are placed. Try the yaml below, that I have explicitly set the output directory for the published dlls and zipped the files after publish(that would probably be your next issue). I have also explicitly set in which folder to look for the published folder in order to publish the artifact.

trigger:
    - master

    pool:
      vmImage: 'windows-latest'

    steps:
    - task: DotNetCoreCLI@2
      inputs:
        command: 'restore'
        feedsToUse: 'select'
    - task: DotNetCoreCLI@2
      inputs:
        command: 'build'
    - task: DotNetCoreCLI@2
      inputs:
        command: 'publish'
        publishWebProjects: true
        modifyOutputPath: true
        arguments: '--configuration $(BuildConfiguration) --output "$(build.artifactstagingdirectory)"'
        zipAfterPublish: true
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'artifact2'

Upvotes: 1

Related Questions