0 votes
by (2.5k points)
edited by
I am trying to build my C# .NET Core project in Azure Pipelines, but I need to use a very specific version of the .NET SDK (I have a global.json set up that specifies a version). Is there a setting I can use to say what version of .NET the build agent will have?

1 Answer

0 votes
by (2.5k points)

For Azure Pipelines, there is actually a task that you have to set up to install a specific version of .NET (It isn't a setting). Documentation for it is here : https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/tool/dotnet-core-tool-installer?view=azure-devops

In short, in YAML it looks like : 

- task: [email protected]
  displayName: 'Use .NET Core sdk'
    packageType: sdk
    version: 3.1.402
    installationPath: $(Agent.ToolsDirectory)/dotnet

It's also available in the GUI pipelines too. 

One thing to keep in mind is that *every* run of the pipeline will download and install the SDK. This can add a few minutes to your build time as a fresh agent will be used each and every time. 

Welcome to .NET Q&A, where you can ask questions and receive answers from other members of the community.