Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update installed .NET SDKs?

Tags:

.net

dotnet --info shows installed sdks:

enter image description here

Now I would like to update them/add new. Is there a command for that?

Currently I am using Visual Studio Installer for that.

EDIT Sep 2023

Apparently you can also use winget tool to manage the sdks.

winget install Microsoft.DotNet.SDK.7

like image 653
Alamakanambra Avatar asked Feb 27 '26 02:02

Alamakanambra


1 Answers

There are a few options.

  • Download and update directly from the web: https://dotnet.microsoft.com/download/visual-studio-sdks
  • Do what you're doing... use Visual Studio's installer

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.

like image 180
Kit Avatar answered Mar 01 '26 17:03

Kit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!