0
votes

I am setting publish build artifacts in Azure DevOps but following error occurred.

'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.

I am doing this to exchange dynamics 365 solution from one instance to another instance using Azure DevOps.

Following is my YAML document for publish build artifacts.

- task: PublishBuildArtifacts@1
  inputs:
    pathtoPublish: $(Build.ArtifactStagingDirectory)
    artifactName: drop
  displayName: 'Publish build artifacts'

Following this link.

I want that publish build artifacts successfully.

1
Looking at that link you provided, does the SolutionPackager task complete successfully for your solution?bryanbcook

1 Answers

1
votes

You have to copy something into your $(Build.ArtifactStagingDirectory) directory before the publish task.

This is example for the .net project:

- task: CopyFiles@2
  displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
  inputs:
    SourceFolder: '$(build.sourcesdirectory)'
    Contents: '**\bin\$(BuildConfiguration)\**'
    TargetFolder: '$(build.artifactstagingdirectory)'
  condition: succeededOrFailed()

As I understand from your link, the powershell task will create a zip file in the $(Build.ArtifactStagingDirectory) directory:

- powershell: |
    Start-Process tools/CoreTools/SolutionPackager.exe `
    -ArgumentList `
      "/action: Pack", `
      "/zipfile: $(Build.ArtifactStagingDirectory)\packedSolution\$env:SolutionName.zip", `
      "/folder: $env:SolutionPath", `
      "/packagetype: Both" `
    -Wait `
    -NoNewWindow
  env:
    SolutionPath: $(solution.path)
    SolutionName: $(solution.name)
  displayName: 'Solution Packager: pack solution'