MATLAB Compiler SDK .NET Target Requirements
System and Product Requirements
System Dependencies
Development of .NET assemblies using MATLAB® Compiler SDK™ is supported on Windows® systems only.
Product Dependencies
The following products must be installed prior to installing and using MATLAB Compiler SDK:
MATLAB
MATLAB Compiler™
.NET assemblies developed using MATLAB Compiler SDK and integrated with .NET applications require MATLAB Runtime during execution. For details, see Install and Configure MATLAB Runtime.
Supported Microsoft .NET Versions
Microsoft® .NET Framework 4.x
Microsoft .NET Core 2.0 or higher
Microsoft .NET 5.0 or higher
For an up-to-date list of .NET versions supported by MATLAB Compiler SDK, see https://www.mathworks.com/support/compilers/current_release/.
You can download and install .NET SDK from https://dotnet.microsoft.com/download.
Compatibility
If you are loading a deployed application that references an assembly built with version
4.0
or above, you need to install .NET Framework version4.0
or above (such as4.7
or4.8
). The .NET Framework used for building the assembly may have a version higher than the one used to load the application.If you are loading a deployed application that references an assembly built with version
5.0
, you do not need to install .NET to load the application.Cross-platform applications can be only be developed using .NET Core 2.0 or higher and .NET 5.0 or higher.
Caution
According to Microsoft, .NET Framework 4.8 is the last version of .NET Framework. For new .NET development, Microsoft recommends using .NET 5.0 or higher.
Data API
MathWorks® provides two data APIs for handling data exchange between a .NET application and deployed MATLAB code:
MWArray API that works with .NET Framework 4.0 or higher.
MATLAB Data API for .NET that works with .NET 5.0 or higher and select versions of .NET Framework and .NET Core. For details, see Compatibility.
These data APIs are installed on your system when you install MATLAB and MATLAB Compiler SDK or MATLAB Runtime. For assembly reference locations associated with these data APIs, see .NET Development Environment.
MATLAB Data API for .NET is shared between MATLAB Compiler SDK and MATLAB Engine. For details, see Call MATLAB from .NET.
Compatibility
If you plan on using the MATLAB Data API for .NET with .NET Framework or .NET Core, you may want to consider the following limitations:
Deployed applications developed using .NET Framework can run only on Windows systems and not across multiple platforms.
Only the following .NET Framework versions are supported:
4.6.1
,4.6.2
,4.7
,4.7.1
,4.7.2
,4.8
According to Microsoft, .NET Framework 4.8 is the last version of .NET Framework.
.NET Framework does not have a command-line interface for development.
As of R2022b, .NET Core versions
2.0
to3.0
are already out of support from Microsoft and .NET Core3.1
is in a maintenance phase. According to Microsoft, .NET 5.0 and higher represent the successor to .NET Core and are part of the company's plan of a unified .NET stack and ecosystem.
MathWorks recommends using the MATLAB Data API for .NET with .NET 5.0 or higher to deploy MATLAB functions across the broadest array of platforms.
Development Environment
Use the MATLAB desktop to author MATLAB code and MATLAB Compiler SDK to generate .NET assemblies or artifacts from MATLAB code.
Use the .NET command-line interface (CLI) along with a code editor to integrate the assemblies or artifacts generated by MATLAB Compiler SDK with .NET applications. For details, see .NET CLI Overview.
You can also use an integrated development environment (IDE) such as Microsoft Visual Studio® for integrating assemblies or artifacts with applications.
Test your application against the installed version of MATLAB that was used to generate the .NET artifacts or against MATLAB Runtime. However, during deployment you must use MATLAB Runtime.
Cross-platform Support
Starting in R2019b, you can build .NET applications on a Windows platform and run them on Linux® and macOS using .NET Core. To use this functionality, you must have .NET Core 2.0 or higher installed.
Starting in R2022a, you can build .NET applications on a Windows platform and run them on Linux and macOS using .NET 5.0 or higher. To use this functionality, you must have .NET 5.0 or higher installed.
MATLAB Compiler SDK .NET Limitations
The .NET External Interface method
addAssembly
is unsupported.Serializing MATLAB objects from MATLAB into .NET code is unsupported.