Main Content

Assembly Is a Library of .NET Classes

Assemblies are the building blocks of .NET applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly is a collection of types and resources built to work together and form a logical unit of functionality.

To work with a .NET application, you need to make its assemblies visible to MATLAB®. How you do this depends on how the assembly is deployed, either privately or globally.

  • global assembly—Shared among applications and installed in a common folder, called the Global Assembly Cache (GAC).

  • private assembly—Used by a single application.

To load a global assembly into MATLAB, use the short name of the assembly, which is the file name without the extension. To load a private assembly, you need the full path (folder and file name with extension) of the assembly. This information is in the vendor documentation for the assembly. Refer to the vendor documentation for information about using your product.

.NET 6 and higher, including .NET Core, does not support loading assemblies from the GAC. If you use the short name of an assembly, the framework searches for assemblies installed with the Desktop Runtime.

For .NET Framework, assemblies from the .NET Framework class library are available at startup. MATLAB dynamically loads these assemblies the first time you type “NET.” or “System.”.

  • mscorlib.dll

  • system.dll

For .NET 6 and higher, these assemblies are available when .NET is loaded.

  • Microsoft.Win32.Registry

  • System.Runtime

  • System.Xml

  • System.Diagnostics.Process

  • System.Net.NetworkInformation

  • System.Security.Principal

  • System.Security.Principal.Windows

To use any other .NET assembly, load the assembly using the NET.addAssembly function. After loading the assembly, you can work with the classes defined by the assembly.

Note

You cannot unload an assembly in MATLAB. If you modify and rebuild your own assembly, you must restart MATLAB to access the changes.

See Also