If you’re developing or running apps that rely on the .NET Framework or .NET SDK, you might sometimes need to install or switch between versions manually. While the official installer works fine, using the Command Line makes it faster and easier—especially for automation, scripting, or server setups.
In this guide, we’ll show you exactly how to install any .NET version using Command Prompt or PowerShell in Windows 11. We’ll also cover how to verify installations, manage multiple versions, and fix common issues.
Understanding .NET Versions
There are two main types of .NET frameworks you may encounter:
- .NET Framework (Legacy) – Used by older Windows applications (like .NET 4.8).
- .NET (Core/5/6/7/8) – The modern, cross-platform framework for new apps and development.
Depending on what your software needs, you might have to install either or both.
Step 1: Check Which .NET Versions Are Installed
Before installing, it’s good to see what’s already on your system.
Using Command Prompt
dotnet --list-sdks
dotnet --list-runtimes
This command lists all installed .NET SDKs and runtimes.
If you get:
'dotnet' is not recognized as an internal or external command
—it means .NET isn’t installed yet. Proceed to the next step.
Step 2: Install the Latest .NET Version via Command Line
You can easily install any .NET version using PowerShell or Command Prompt by downloading the official installer directly from Microsoft’s servers.
Here’s how:
For PowerShell
Invoke-WebRequest -Uri https://dotnet.microsoft.com/download/dotnet/thank-you/runtime-desktop-8.0.0-windows-x64-installer -OutFile dotnet-installer.exe
Start-Process -FilePath .\dotnet-installer.exe -ArgumentList "/quiet" -Wait
This will:
- Download the .NET 8 runtime installer (you can replace version number as needed).
- Install it silently in the background.
You can replace the URL with any other version:
Tip: Always check which version your application requires before installation.
Step 3: Install a Specific .NET SDK Version
If you need the SDK (for development), not just the runtime, use this command:
Invoke-WebRequest -Uri https://download.visualstudio.microsoft.com/download/pr/6a7cda02-cc45-4f46-8351-3f4b1bb2d5b2/abc123/dotnet-sdk-7.0.403-win-x64.exe -OutFile dotnet-sdk-installer.exe
Start-Process -FilePath .\dotnet-sdk-installer.exe -ArgumentList "/quiet" -Wait
Replace the URL with the direct link for your target version. You can find links for all versions here: https://dotnet.microsoft.com/download/dotnet
Step 4: Install .NET Framework (Older Versions) via Command Line
If you need to install the older .NET Framework (like 3.5 or 4.8), you can use DISM or PowerShell.
To Install .NET Framework 3.5
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs
Replace D: with your Windows installation media drive letter.
To Install .NET Framework 4.8
You can download and run the offline installer via PowerShell:
Invoke-WebRequest -Uri https://download.microsoft.com/download/2/E/6/2E6C7F16-5CF9-4C1C-A3A8-4B4F7E9A2A0B/ndp48-web.exe -OutFile ndp48-web.exe
Start-Process -FilePath .\ndp48-web.exe -ArgumentList "/quiet" -Wait
After installation, restart your PC.
Step 5: Verify .NET Installation
Once installation is done, check your setup with:
dotnet --info
This displays:
- Installed SDKs
- Runtime versions
- Architecture (x64/x86)
- Installation paths
You can also check specific version folders:
C:\Program Files\dotnet\sdk
C:\Program Files\dotnet\shared\Microsoft.NETCore.App
Step 6: Manage Multiple .NET Versions
If you have multiple .NET versions installed, you can choose which one to use for your project using a global.json file.
Example:
{
"sdk": {
"version": "7.0.403"
}
}
Place this file in your project directory to lock it to that version.
Common Issues & Fixes
1. ‘dotnet’ command not found:
Make sure the installation path is in your system’s Environment Variables:
C:\Program Files\dotnet\
2. Installer stuck or fails:
Run PowerShell as Administrator and use the /norestart /quiet parameters for silent installs.
3. Need to uninstall an older version:
Use:
wmic product where "name like 'Microsoft .NET%'" get name, version
Then uninstall via:
wmic product where "name like 'Microsoft .NET SDK%7.0%'" call uninstall
Conclusion
Installing any .NET version using Command Line is a quick and powerful method—perfect for developers, sysadmins, or anyone managing multiple machines.
With just a few PowerShell commands, you can download, install, and verify any .NET version—whether it’s the latest .NET 8 or a legacy framework like 3.5 or 4.8.
Once installed, use dotnet --info to confirm everything’s running smoothly, and you’re ready to build or run your .NET applications with confidence.