Why do I get the error "Could not load file or assembly 'MWArray'" when deploying a 32-bit C# application created using MATLAB Builder NE 3.0.2 (R2009b) on a 64-bit Windows?

I have created a C# application on a 32-bit Windows machine that uses a 32-bit Builder NE component. The application works fine on the development machine.
Now I want to deploy the application on a 64-bit Windows on which I installed the 32-bit version of the MCR.
When I run the application, I get the following error:
Could not load file or assembly 'MWArray, Version=2.9.1.0, Culture=neutral, PublicKeyToken=e1d84a0da19db86f' or one of its dependencies. The system cannot find the file specified.

 Accepted Answer

Applications created from C# are compiled as managed code, which makes them platform independent (like Java, for example). Thus, when you compile a C# application on a 32-bit machine and then deploy it on a 64-bit machine, it will, by default, try to run as a 64-bit application. Then, it will try to find the 64-bit version of the MWArray.dll, and if it fails, the mentioned error will be shown.
To work around this issue, set the option "Properties -> Build -> Platform target" to "x86" instead of "Any CPU" before compiling your C# application. This will have the effect that the application will start in 32-bit mode on the 64-bit machine.

More Answers (0)

Categories

Products

Release

R2009b

Tags

Community Treasure Hunt

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

Start Hunting!