Magic Square Component in a C# Application

  1. Write source code for an application that uses the .NET component created in Create a .NET Assembly.

    The C# source code for the sample application for this example is in MagicSquareExample\MagicSquareCSApp\MagicSquareApp.cs.

      Tip   Although MATLAB® Compiler SDK™ generates C# code for the MagicSquare component and the sample application is in C#, applications that use the component do not need to be coded in C#. You can access the component from any CLS-compliant .NET language.

  2. Build the application using Visual Studio® .NET.

      Note:   In the project file for this example, the MWArray assembly and the magic square component assembly have been prereferenced. Any references preceded by an exclamation point require you to remove the reference and rereference the affected assembly.

      Note:   Microsoft® .NET Framework version 2.0 is not supported by Visual Studio 2003.

    1. Open the project file for the Magic Square example (MagicSquareCSApp.csproj) in Visual Studio .NET.

    2. Add a reference to the MWArray component in matlabroot\toolbox\dotnetbuilder\bin\architecture\framework_version.

      See Supported Microsoft .NET Framework Versions for a list of supported framework versions.

    3. If necessary, add a reference to the Magic Square component (MagicSquareComp), which is in the distrib subfolder.

Was this topic helpful?