0
votes

So far I have been using my own build Powershell script to build my code. Why? Because I like to have a binary log when a diag build is requested and have it attached to the build as an artifact.

But now that I use YAML I would like to use more of the standard tasks available with Azure DevOps. Namely the DotNet Build task. But I do not see how can I make it generate the binary log and attach to the build without writing a custom script anyway. I want it to work transparently - triggering a diag build (i.e. System.Debug is true) should do two things:

  1. Pass -bl:TheBinaryLogFilePath to the dotnet build
  2. Attach TheBinaryLogFilePath to the build as an artifact.

Is it possible in a straightforward manner without writing a custom script (otherwise not worth using the standard task anyway)?

1

1 Answers

0
votes

You dont have control over what changes when you do a debug build. and this is probably something that won't ever happen automatically because I dont see a reason why\how Microsoft would implement something that alters how my apps are being built.

As for the standard task, you can pass additional arguments to it using the arguments: property.

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#yaml-snippet

then you'd have to instruct publish artifacts task to pick up that binary folder path as well. thats it.

if you want to have conditions - fine, use conditions:

  - ${{ if eq($(System.Debug), 'true') }}:
    - task: DotNetCoreCLI@2
      displayName: build
      inputs:
        command: build
        publishWebProjects: false
        zipAfterPublish: false
        modifyOutputPath: false
        projects: xxx
        arguments: |
          -bl:TheBinaryLogFilePath