Microsoft announced today that it now supports installing and maintaining .NET via the Windows Package Manager and PowerShell.
“Windows users now have a convenient way of installing .NET: the Windows Package Manager (winget),” Microsoft’s Ashita Nagar writes. “Winget makes it simple to find, install, uninstall, and update .NET from a Command prompt or PowerShell session.”
.NET 5.0, 6.0, 7.0 (currently in beta), and .NET Core 3.1 are available via the Windows Package Manager, though out-of-support versions, like 5.0, won’t be receiving any updates. This way you can install multiple versions of the .NET runtimes and Software Developer Kits (SDKs) with no versioning/dependency worries.
You can search for all .NET-related commands by typing:
winget search Microsoft.DotNet
Then, you can install a specific .NET SDK or runtime using the following:
winget install <package-id>
So, for example, to install the .NET 6 SDK, type:
winget install Microsoft.DotNet.SDK.6
And then you can check for .NET updates using: