How to determine if .NET Core is installed

前端 未结 16 1799
难免孤独
难免孤独 2020-12-07 06:53

I know that for older versions of .NET, you can determine if a given version is installed by following

https://support.microsoft.com/en-us/kb/318785  


        
相关标签:
16条回答
  • 2020-12-07 07:32

    The following commands are available with .NET Core SDK 2.1 (v2.1.300):

    To list all installed .NET Core SDKs use: dotnet --list-sdks

    To list all installed .NET Core runtimes use dotnet --list-runtimes

    (tested on Windows as of writing, 03 Jun 2018, and again on 23 Aug 2018)

    Update as of 24 Oct 2018: Better option is probably now dotnet --info in a terminal or PowerShell window as already mentioned in other answers.

    0 讨论(0)
  • 2020-12-07 07:32

    You can see which versions of the .NET Core SDK are currently installed with a terminal. Open a terminal and run the following command.

    dotnet --list-sdks
    
    0 讨论(0)
  • 2020-12-07 07:34

    Great question, and the answer is not a simple one. There is no "show me all .net core versions" command, but there's hope.

    EDIT:

    I'm not sure when it was added, but the info command now includes this information in its output. It will print out the installed runtimes and SDKs, as well as some other info:

    dotnet --info

    If you only want to see the SDKs: dotnet --list-sdks

    If you only want to see installed runtimes: dotnet --list-runtimes

    I'm on Windows, but I'd guess that would work on Mac or Linux as well with a current version.

    Also, you can reference the .NET Core Download Archive to help you decipher the SDK versions.


    OLDER INFORMATION: Everything below this point is old information, which is less relevant, but may still be useful.

    See installed Runtimes:

    Open C:\Program Files\dotnet\shared\Microsoft.NETCore.App in Windows Explorer

    See installed SDKs:

    Open C:\Program Files\dotnet\sdk in Windows Explorer

    (Source for the locations: A developer's blog)


    In addition, you can see the latest Runtime and SDK versions installed by issuing these commands at the command prompt:

    dotnet Latest Runtime version is the first thing listed. DISCLAIMER: This no longer works, but may work for older versions.

    dotnet --version Latest SDK version DISCLAIMER: Apparently the result of this may be affected by any global.json config files.


    On macOS you could check .net core version by using below command.

    ls /usr/local/share/dotnet/shared/Microsoft.NETCore.App/
    

    On Ubuntu or Alpine:

    ls /usr/share/dotnet/shared/Microsoft.NETCore.App/
    

    It will list down the folder with installed version name.

    0 讨论(0)
  • 2020-12-07 07:34

    Using Powershell:

    Runtimes:

    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'shared\Microsoft.NETCore.App')).Name
    

    SDKs:

    (dir (Get-Command dotnet).Path.Replace('dotnet.exe', 'sdk')).Name
    
    0 讨论(0)
  • 2020-12-07 07:36

    I work primarily with Windows development machines and servers.

    I just wanted to point out (at least for NET.Core 2.0 and above) the only thing needed is to execute dotnet --info in a command prompt to get information about the latest version installed. If .NET Core is installed you will get some response.

    On my development machine (Windows 10) the result is as follows. SDK is 2.1.2 and runtime is 2.0.3.

    .NET Command Line Tools (2.1.2)
    
    Product Information:
     Version:            2.1.2
     Commit SHA-1 hash:  5695315371
    
    Runtime Environment:
     OS Name:     Windows
     OS Version:  10.0.15063
     OS Platform: Windows
     RID:         win10-x64
     Base Path:   C:\Program Files\dotnet\sdk\2.1.2\
    
    Microsoft .NET Core Shared Framework Host
    
      Version  : 2.0.3
      Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
    

    On one of my servers running Windows Server 2016 with Windows Server Hosting pack (no SDK) result is as follows. No SDK, runtime is 2.0.3.

    Microsoft .NET Core Shared Framework Host
    
    Version  : 2.0.3
    Build    : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
    

    Cheers !

    0 讨论(0)
  • 2020-12-07 07:37

    On windows, You only need to open the command prompt and type:

    dotnet --version
    

    If the .net core framework installed you will get current installed version

    see screenshot:

    0 讨论(0)
提交回复
热议问题