Search code examples
azure-devopsazure-pipelinesazure-pipelines-yamlcakebuild

How to specify Cake.Tool version on yaml task in Azure devops pipelines


I have this yaml task to run a build.cake file.

- task: cake-build.cake.cake-build-task.Cake@2
  displayName: 'Build Sources'
  inputs:
    script: devops/build.cake
    target: Default
    verbosity: Normal
    arguments: '--Configuration="$(build.configuration)" --Platform="$(build.platform)" --artifactsPath="$(Build.ArtifactStagingDirectory)"'
    

When this task executes it always installs the latest version of Cake.Tool. This a section of the pipelines logs:

2021-10-25T20:52:28.6148998Z ==============================================================================
2021-10-25T20:52:28.6149081Z Task         : Cake
2021-10-25T20:52:28.6149119Z Description  : Build with Cake
2021-10-25T20:52:28.6149153Z Version      : 2.1.0
2021-10-25T20:52:28.6149199Z Author       : Patrik Svensson
2021-10-25T20:52:28.6149233Z Help         : [More Information about Cake](https://cakebuild.net)
2021-10-25T20:52:28.6149267Z ==============================================================================
2021-10-25T20:52:29.0331876Z =====================================================
2021-10-25T20:52:29.0332236Z Root = D:\Agents\00\_work\265\s\devops
2021-10-25T20:52:29.0332411Z Tools = D:\Agents\00\_work\265\s\devops\tools
2021-10-25T20:52:29.0332915Z Cake Tool Path = D:\Agents\00\_work\265\s\devops\tools\dotnet-cake.exe
2021-10-25T20:52:29.0334592Z Package Feed = 
2021-10-25T20:52:29.0335733Z Running with system diagnostics
2021-10-25T20:52:29.0336048Z =====================================================
2021-10-25T20:52:29.0339302Z Installing Cake Tool (Latest)...
2021-10-25T20:52:29.0577395Z [command]"C:\Program Files\dotnet\dotnet.exe" tool install --tool-path D:\Agents\00\_work\265\s\devops\tools/ Cake.Tool
2021-10-25T20:52:37.3622249Z You can invoke the tool using the following command: dotnet-cake
2021-10-25T20:52:37.3622761Z Tool 'cake.tool' (version '1.3.0') was successfully installed.
2021-10-25T20:52:37.3766624Z 

In this case it installed version 1.3.0. How do I fix this version number? How do I tell it to always use version 1.0.0 for instance. I haven't find any documentation on this.


Solution

  • You should be able to specify version using version property

    - task: cake-build.cake.cake-build-task.Cake@2
      displayName: 'Build Sources'
      inputs:
        version: 1.0.0
        script: devops/build.cake
        target: Default
        verbosity: Normal
        arguments: '--Configuration="$(build.configuration)" --Platform="$(build.platform)" --artifactsPath="$(Build.ArtifactStagingDirectory)"'