Run a prerelease version of DotNetCoreCLI in Azure Pipelines

345 Views Asked by At

Is it possible to run a pre-release version of the DotNetCoreCLI task when writing an Azure Pipelines yaml script? I would like to use 3.0.1xx if possible to take advantage of dotnet tool update installing the tool rather than throwing an error if not installed.

If it is possible, what would the syntax be to make a call like this use a prerelease version rather than version 2:

- task: DotNetCoreCLI@2
  continueOnError: true
  inputs:
    command: custom
    custom: tool
    arguments: install -g coverlet.console
  displayName: Install Coverlet tool. This task will continue on error if coverlet is already installed.
1

There are 1 best solutions below

3
On BEST ANSWER

you could use the following:

steps:
- task: UseDotNet@2
  displayName: 'Use .NET Core sdk'
  inputs:
    packageType: sdk
    version: 3.0.101
    installationPath: $(Agent.ToolsDirectory)/dotnet

possible versions: https://github.com/dotnet/core/blob/master/release-notes/releases-index.json

reading: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops