Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (39 sloc) 1.51 KB
layout title date
post
Where is .NET Core installed on macOS?
2017-07-05 6:33:00

And exactly what versions are installed?

In a recent blog post Iris Classon wrote a PowerShell script that lists installed .NET Core SDK, runtime, and Framework Host versions installed on a Windows machine.

I am mostly using my Mac for .NET Core development so it got me thinking about where .NET Core actually is installed on macOS. The answer is

/usr/local/share/dotnet/

The following script

#!/bin/sh
DOTNET="/usr/local/share/dotnet"

if [ -d $DOTNET ] ; then

  printf "\nSDK versions:\n"
  ls -1 $DOTNET/sdk

  printf "\nInstalled runtime versions:\n"
  ls -1 $DOTNET/shared/Microsoft.NETCore.App

  printf "\nFramework host versions:\n"
  ls -1 $DOTNET/host/fxr
fi

will list installed .NET Core SDK, runtime, and Framework Host versions installed on a Mac.

If you run dotnet --info from the commandline you will see the default SDK version. You can change what SDK version to use by adding a section in the global.json file. The dotnet executable will look for such a file in the root folder of your project.

The format of the global.json looks like

{
  "sdk": {
    "version": "1.0.4"
  }
}

If you now run dotnet --info you should see:

tmp ➜ dotnet --info
.NET Command Line Tools (1.0.4)

Product Information:
 Version:            1.0.4