Use .NET Core task

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019

Use this task to acquire a specific version of .NET Core from the Internet or the tools cache and add it to the PATH.

You can also use this task to change the version of .NET Core used in subsequent tasks like .NET Core cli task.

One other reason to use tool installer is if you want to decouple your pipeline from our update cycles to help avoid a pipeline run being broken due to a change we make to our agent software.

What's New

  • Support for installing multiple versions side by side.

  • Support for patterns in version to fetch latest in minor/major version. For example, you can now specify 3.1.x to get the latest patch.

  • Perform Multi-level lookup. This input is only applicable to Windows based agents. It configures the .NET Core's host process behavior for looking for a suitable shared framework on the machine. For more information, see Multi-level SharedFX Lookup.

  • Installs NuGet version 4.4.1 and sets up proxy configuration if present in NuGet config.

Task Inputs

Package to install
Please select whether to install only runtime or SDK
Default value: sdk
Use global json
Select this option to install all SDKs from global.json files. These files are searched from system.DefaultWorkingDirectory. You can change the search root path by setting working directory input
Working Directory
Specify path from where global.json files should be searched when using `Use global json`. If empty, system.DefaultWorkingDirectory will be considered as the root path
Specify version of .NET Core SDK or runtime to install.
Versions can be given in the following formats
  • 2.x => Install latest in major version.
  • 3.1.x => Install latest in major and minor version
  • 3.1.402 => Install exact version

  • Find the value of version for installing SDK/Runtime, from the releases.json. The link to releases.json of that major.minor version can be found in releases-index file.. Like link to releases.json for 3.1 version is
    Include Preview Versions
    Select if you want preview versions to be included while searching for latest versions, such as while searching 3.1.x. This setting is ignored if you specify an exact version, such as: 3.0.100-preview3-010431
    Default value: false
    Path To Install .NET Core
    Specify where .NET Core SDK/Runtime should be installed. Different paths can have the following impact on .NET's behavior.
  • $(Agent.ToolsDirectory): This makes the version to be cached on the agent since this directory is not cleanup up across pipelines. All pipelines running on the agent, would have access to the versions installed previously using the agent.
  • $(Agent.TempDirectory): This can ensure that a pipeline doesn't use any cached version of .NET core since this folder is cleaned up after each pipeline.
  • Any other path: You can configure any other path given the agent process has access to the path. This will change the state of the machine and impact all processes running on it.
    Note that you can also configure Multi-Level Lookup setting which can configure .NET host's probing for a suitable version.
    Default value: $(Agent.ToolsDirectory)/dotnet
  • performMultiLevelLookup
    Perform Multi Level Lookup
    This input is only applicable to Windows based agents. This configures the behavior of .NET host process for looking up a suitable shared framework.
  • false: (default) Only versions present in the folder specified in this task would be looked by the host process.
  • true: The host will attempt to look in predefined global locations using multi-level lookup.
    The default global locations are:
    For Windows:
    C:/Program Files/dotnet (64-bit processes)
    C:/Program Files (x86)/dotnet (32-bit process)
  • You can read more about it HERE

    This YAML example installs version 3.1.402 of .NET Core.

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

    Open source

    This task is open source on GitHub. Feedback and contributions are welcome.