Main Content


Change .NET default environment on Microsoft Windows platforms

Since R2022b


    ne = dotnetenv returns NETEnvironment which contains details about the current .NET run-time environment. For information about .NET implementations compatible with MATLAB®, see MATLAB Interfaces to Other Languages.


    ne = dotnetenv(version) changes the default .NET version used to load .NET assemblies in MATLAB. The run-time is initialized when you call functions in either NET or System packages.


    collapse all

    Set the .NET run-time to the latest version.

    ne = dotnetenv("core")
    ne = 
      NETEnvironment with properties:
            Runtime: core
             Status: loaded
            Version: ".NET 5.0.16"
    RuntimeLocation: "C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.16\"

    Input Arguments

    collapse all

    .NET version, specified as a string or a character vector. Changes the default .NET version on Microsoft® Windows® platforms.

    • "framework"—Changes the default .NET version to the .NET Framework.

    • "core"—Changes the default .NET version to the latest version of .NET.

    Version History

    Introduced in R2022b