Failed to load a .NET assembly

9 views (last 30 days)
Mauro Gandolfo
Mauro Gandolfo on 27 Jul 2011
When I try to load a .NET assembly by typing:
asm = NET.addAssembly('fullPath');
I get the following error: "Could not load file or assembly 'file:///fullPath' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. Source: mscorlib HelpLink:"
I've Matlab R2010a and the assembly is targeted for .NET framework 4.0.

Answers (1)

Kaustubha Govind
Kaustubha Govind on 1 Aug 2011
What version of MATLAB did you use to build your .NET assembly? The latest version (R2011a) supports .NET Framework 4.0: http://www.mathworks.com/products/netbuilder/requirements.html, but I know that older releases used older .NET versions. You might need to build with a newer version to load your assembly with 4.0.
  2 Comments
Mauro Gandolfo
Mauro Gandolfo on 1 Aug 2011
Thanks for your answer, but I'm a bit confused. What do you mean for building with MATLAB? For building the .NET assembly I've used Visual Studio targeting the .NET 4.0 framework. I'm trying to add the assembly to MATLAB with the 2010a release and to use its functionalities.
Kaustubha Govind
Kaustubha Govind on 2 Aug 2011
Oops. Apologies! I misunderstood your question.
The issue you are facing has been documented at http://www.mathworks.com/support/solutions/en/data/1-CNPYZV/index.html
So it looks like you will need to upgrade to R2011a to be able to use .NET 4.0 assemblies.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!