Main Content

Selecting .NET Core in MATLAB

Selecting the .NET 6 and higher run-time environment

MATLAB® supports loading these .NET assemblies:

  • .NET, including .NET Core (Microsoft® Windows®, macOS, and Linux®)

  • .NET Framework (Windows only)

For details, see System Requirements for Using MATLAB Interface to .NET. For information about .NET versions compatible with MATLAB, see MATLAB Interfaces to Other Languages.

By default, MATLAB loads assemblies using .NET Framework on Microsoft Windows, and using .NET Core on macOS and Linux. To select .NET Core on Microsoft Windows, use the dotnetenv function. The .NET environment information is persistent across different MATLAB sessions.

To select the .NET Core run-time environment, first check if .NET is already loaded. You might have to restart MATLAB.

e = dotnetenv;
if e.Status=="loaded"
    disp("To change the environment, restart MATLAB then call dotnetenv.")
end

Set the .NET Runtime environment to the latest version.

e = dotnetenv("core")
e = 
  NETEnvironment with properties:

            Runtime: core
             Status: loaded
            Version: ".NET 7.0.10"
    RuntimeLocation: "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\7.0.10\"

Functions

dotnetenvChange .NET default environment (Since R2022b)

Objects

NETEnvironment.NET environment information (Since R2022b)

Topics