Building .Net assembly with a different .Net Framework target

30 visualizzazioni (ultimi 30 giorni)
Hi,
I am currently building a .NET dll from a Matlab class using mcc.
I want to change the target version of the .NET Framework since the previously used .NET Framework 4.0. is quite old.
Compiling with 4.0 target works fine
mcc -B 'dotnet:MyClass,MyClass,0.0,Private,local' myclass.m
Also this works
mcc -B 'dotnet:MyClass,MyClass,0.0,Private,local' myclass.m
But changing the target no longer works, I do have different .net Framework since we are building other apps agains 4.7.2 outside Matlab.
mcc -B 'dotnet:MyClass,MyClass,4.7.2,Private,local' myclass.m
Invalid .NET framework.
The specified framework either was not found or is not currently supported.
What do I have to do to build with 4.7.2 target? Is this possible ?
I would need this for both 2019b and 2022a versions.
Thank you!

Risposte (1)

aditi bagora
aditi bagora il 27 Ott 2023
Hi Silviu,
I understand that you're attempting to build a .NET dll using mcc with the 4.7.2 .NET Framework. It seems that you've been successful in building it for the .NET 4.0 version.
Based on the error message you received, there are two possibilities: either the specified framework does not exist, or it is not supported. Since you mentioned that you have working applications on the same framework, it's likely that the framework version is not supported by MATLAB Compiler.
Here's some information regarding supported .NET Framework versions in different MATLAB releases:
  • MATLAB R2019b: You can build for .NET Framework version 4.0 or above (such as 4.5 or 4.6). If you have both 4.x and an older version of .NET Framework (2.x-3.x), you should be able to build the assembly. However, if you only have an older version of .NET Framework, you'll need to install version 4.0 or above to build a new assembly.
  • MATLAB R2022a: .NET Framework 4.x is supported.
  • MATLAB R2023b: .NET Framework 4.6.2 or higher is supported.
For more detailed information on supported .NET Framework versions in each MATLAB release, please refer to the following links:
Hope this helps solving your query regarding building your code in .NET Framework.
Regards,
Aditi

Prodotti


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by