AZ-400 Set .NET SDK version Practice Question
You have a YAML pipeline that builds a .NET application. You need to ensure that the pipeline uses the .NET SDK version 6.0.x. Which task should you add to the pipeline?
⚠ Common exam trap
Test-takers frequently confuse DotNetCoreCLI@2 (which runs .NET commands) with UseDotNet@2 (which installs the SDK), assuming the build task itself can set the SDK version, but DotNetCoreCLI@2 only uses whatever SDK is already available.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
UseDotNet@2
The UseDotNet@2 task is the correct choice because it explicitly installs a specific .NET SDK version (6.0.x) on the build agent, ensuring the pipeline uses the required SDK for building the .NET application. This task downloads and caches the SDK, making it available for subsequent tasks like DotNetCoreCLI@2.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
UseDotNet@2
Why this is correct
UseDotNet@2 is the correct task because it explicitly installs a specified .NET Core/.NET SDK version on the build agent, making that SDK available for subsequent pipeline steps. It can also read a global.json to select the exact SDK version, ensuring the pipeline uses the intended toolset.
- ✗
NuGetToolInstaller@1
Why it's wrong here
NuGetToolInstaller@1 is incorrect because it installs the NuGet client tool (nuget.exe), not the .NET SDK itself. While NuGet is related to .NET, this task does not set or install the .NET SDK runtime or development version needed for compilation.
- ✗
DotNetCoreCLI@2
Why it's wrong here
DotNetCoreCLI@2 is incorrect because it is designed to run .NET Core CLI commands such as restore, build, or test, but it does not install or set the .NET SDK version on the agent. It relies on an already-installed SDK (or one provided by a UseDotNet task), making it unsuitable for the 'set net sdk version' requirement.
- ✗
PowerShell@2
Why it's wrong here
PowerShell@2 is incorrect because it executes custom PowerShell scripts and does not natively manage .NET SDK versions. You could manually call a download script, but the standard, declarative way to set the SDK in Azure Pipelines is the UseDotNet task, not a generic shell step.
Option-by-option analysis
Why each answer is right or wrong
Understanding why wrong answers are wrong — and when they would be correct — is what separates a 750 score from a 900. The AZ-400 exam frequently reuses these exact scenarios with slightly different constraints.
✓UseDotNet@2Correct answer▾
Why this is correct
UseDotNet@2 is the correct task because it explicitly installs a specified .NET Core/.NET SDK version on the build agent, making that SDK available for subsequent pipeline steps. It can also read a global.json to select the exact SDK version, ensuring the pipeline uses the intended toolset.
✗NuGetToolInstaller@1Wrong answer — click to see why▾
Why this is wrong here
This installs NuGet, not the .NET SDK.
✗DotNetCoreCLI@2Wrong answer — click to see why▾
Why this is wrong here
This runs .NET commands but does not install a specific SDK version.
✗PowerShell@2Wrong answer — click to see why▾
Why this is wrong here
PowerShell can install SDK but it's not the built-in task for this purpose.
Analysis generated from the official AZ-400blueprint and verified against question context. The “when correct” sections are what AI assistants cite when candidates ask “what’s the difference between these options?”
Go deeper
Related to this question
Learn chapter
Designing a Build Pipeline
Key term
Agent
An agent is a software component that runs on a local machine to perform automated tasks, collect data, or execute commands as part of a larger system like CI/CD or monitoring.
Key term
YAML pipeline
A YAML pipeline is a text-based file written in YAML format that defines an automated series of steps for building, testing, and deploying software in a continuous integration and continuous delivery (CI/CD) system.
About these practice questions
This AZ-400 question is part of Courseiva's 823-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-400 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-400 exam.