.NET from Matlab

July 17, 2026 ยท View on GitHub

.NET support in MATLAB when a compatible .NET SDK is installed includes:

  • Windows: all supported Matlab releases
  • Linux or macOS: R2024b and newer

macOS .NET with Matlab

brew install dotnet

in Matlab

edit(fullfile(userpath, 'startup.m'))

add the lines

setenv('HOMEBREW_PREFIX', '/opt/homebrew')
setenv('DOTNET_ROOT', [getenv('HOMEBREW_PREFIX') '/opt/dotnet/libexec'])

restart Matlab, then issue the one-time setup command [ dotnetenv

dotnetenv("core", Version="10")

where "10" must match the installed .NET SDK major version from

dotnet --list-sdks

Windows .NET with Matlab

Windows normally has .NET already available with Matlab, but it may be an old .NET version lacking newer features. A current .NET SDK can be installed using winget

winget search Microsoft.DotNet.SDK

To find the installed .NET SDK file location:

dotnet --list-sdks

since the usual winget list Microsoft.DotNet.SDK --details might not show the installed location.

In Matlab

edit(fullfile(userpath, 'startup.m'))

add the location obtained from dotnet --list-sdks to the DOTNET_ROOT environment variable, for example:

setenv('DOTNET_ROOT', 'C:/Program Files/dotnet/sdk')

restart Matlab, then issue the one-time setup command

dotnetenv("core", Version="10")

where "10" must match the installed .NET SDK major version from

dotnet --list-sdks