1

I have a simple build pipeline that triggers on my git commit and is working great.

Here is the .yaml for that process:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
  - script: dotnet build --configuration $(buildConfiguration)
  - task: ArchiveFiles@2
inputs:
  rootFolderOrFile: '$(Build.BinariesDirectory)'
  includeRootFolder: true
  archiveType: 'zip'
  archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
  replaceExistingArchive: true
  displayName: 'dotnet build $(buildConfiguration)'

Then, I tried to make a Release build, but can't get the zip file across to my deploy step. The steps I follow are:

  1. Publish build artifacts
  2. Download build artifacts
  3. Deploy web service

Here is my setup - Overall release pipeline:

enter image description here

Artifact Stage setup as follow:

enter image description here

Here is my 3 tasks in the Stage 1 (Deploy Stage):

enter image description here

Then the 3 tasks's properties:

enter image description here enter image description here enter image description here

And here is the error I'm getting, it is with regard to the artefact publish directory:

enter image description here

1 Answer 1

2

You should use dotnet publish to create your binaries. The step will also create a zip file. Then to publish the artefacts, use the PublishBuildArtifacts@1 Task. These steps should all be done within a build, not a release.

Here an example:

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: DotNetCoreCLI@2
  inputs:
    command: 'publish'
    publishWebProjects: false
    projects: '**/*.csproj'
    arguments: '-o /app'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '/app'
    ArtifactName: 'drop'
    publishLocation: 'Container'

Within the release, you don't need the Publish and Download Build Artefact step since the artefacts are already there (_ISOF). After you run the first Build, you can just select the zip file in the "Package or folder" dropdown.

Sign up to request clarification or add additional context in comments.

2 Comments

I see, thanks! With regard to the publish location - what is this field related to, the path, the type of location? or what should I enter there? I'm stil new to azure dev ops so I'm still not sure if the storage space from build is accessible to release
"In most cases, Azure Pipelines/TFS (Server on TFS 2018 RTM and older) is the best and simplest option. Otherwise, choose a file share and then specify a few more arguments (see below). If left empty or container is specified, it will have the same effect as specifying Azure Pipelines/TFS. To learn more, see " See this Link: learn.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.