dotnet --info shows installed sdks:

Now I would like to update them/add new. Is there a command for that?
Currently I am using Visual Studio Installer for that.
Apparently you can also use winget tool to manage the sdks.
winget install Microsoft.DotNet.SDK.7
There are a few options.
If you're asking for a dotnet CLI way of doing it (maybe for DevOps or automated scenarios), there is not a way to do that with dotnet itself. You can, however, do these where it makes sense.
Using scripting: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
For Windows installation you can try Install .NET on Windows
For DevOps in Azure:
stages :
- stage: Build
jobs:
- job: Build
steps:
- task: UseDotNet@2
displayName: 'Install latest .NET'
inputs:
packageType: 'sdk'
version: 8.x
performMultiLevelLookup: true
includePreviewVersions: true
One nuance to your question: I don't think you can (or should) simply "upgrade"; you have to install. The reason, is the SDKs are designed to run side-by-side, so "upgrade" doesn't quite make sense.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With