0

I have a WinForms application. I have created a build pipeline for the same but unable to get anything in Artifacts.

Actually I need the build of the project in the Zipped folder. Any reference for the same will be appreciated.

Following is the Yaml file for the pipeline.

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'
  ScmBuildProject: 'DemoAppForAzurePipeLine'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: $(ScmBuildName)'
  inputs:
    PathtoPublish: '$(build.artifactstagingdirectory)'
    ArtifactName: '$(ScmBuildName)'
  condition: succeededOrFailed()

1 Answer 1

1

Assuming that your build output is here $(Build.SourcesDirectory)/YourProject/bin/release/' you can use archive task

- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(Build.SourcesDirectory)/YourProject/bin/release/'
    #includeRootFolder: true 
    #archiveType: 'zip' # Options: zip, 7z, tar, wim
    #tarCompression: 'gz' # Optional. Options: gz, bz2, xz, none
    #archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' 
    #replaceExistingArchive: true 
    #verbose: # Optional
    #quiet: # Optional

and it puts it then in archiveFile $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'

Put this step before PublishBuildArtifacts and it should be fine. Please double check your output path for your binaries (I mean this $(Build.SourcesDirectory)/YourProject/bin/release/)

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

1 Comment

Thanks Krzysztof. I am able to get the desired result.

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.