0
votes

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

1 Answers

1
votes

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/)