Why do I receive an error when I try to run my C# application that uses an assembly built by MATLAB Builder for .NET?
5 views (last 30 days)
Show older comments
I have built an assembly using MATLAB Builder for .NET on a 32-bit machine. This assembly is being used by a C# application that is being built on a 64-bit machine. The application has the MATLAB Builder for .NET generated assembly referenced, and builds correctly. However, the following error is thrown at runtime:
System.BadImageFormatException was unhandled
Message="Could not load file or assembly 'MWArray, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=e1d84a0da19db86f' or one of its
dependencies. An attempt was made to load a program with an incorrect
format."
Source="MatLabConsoleApplication"
FileName="MWArray, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=e1d84a0da19db86f"
Accepted Answer
MathWorks Support Team
on 20 Aug 2009
Components generated by the 32-bit builder products are not supported on 64-bit machines.
An assembly built using the MATLAB Builder for .NET on a 32-bit machine has a reference to a 32-bit MWArray assembly, which depends on the 32-bit native MCR libraries. As a result, this assembly should only be referenced in a 32-bit application. If referenced in a 64-bit application, the BadImageFormatException will be thrown by the application at runtime.
0 Comments
More Answers (0)
See Also
Categories
Find more on Deploy to .NET Applications Using MATLAB Data API for .NET in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!