Compiling
Creating a C# compilation work product
We are now going to proceed with the compilation of the bank application. Compilation is run from a component.
To compile the application, carry out the steps shown in Figures 16, 17 and 18.

Figure 16. Creating a component and selecting its type
Steps:
1.
Select the root package (in our
example, the "Bank" package), and create a component by clicking
on the
"Create a C# executable"
icon.
2. Enter "BankApp" as the name of your new component.
3. In the "C#" tab of the auxiliary window, observe that the "Component type" field has been automatically set to "CsExecutable".
Continue with the steps illustrated in Figure 17.

Figure 17. Creating a C# compilation work product
Steps:
1. Select the "BankApp" component in the explorer.
2.
Click on the
"C# makefile" icon. The makefile creation window then appears.
3. Click on "OK" to confirm makefile creation.
Note: The window used to create compilation work products automatically opens when the "C# Developer/Compile" command is run from the context menu on a component, if the component in question does not already have a compilation work product.
Continue by carrying out the operations shown in Figure 18 below.

Figure 18. Creating a reference from the makefile to the "Bank" package
Steps:
1. In the explorer, select the makefile work product you just created.
2. Double-click in the background of the fast link editor to freeze your selection.
3. Drag and drop the "Bank" package from the explorer into the fast link editor.
Generating the makefile
When a makefile is generated from a component or from a component's C# compilation work product, the classes of the selected package are recursively compiled.
To generate a makefile, proceed as shown in Figure 19 below.

Figure 19. Generating the makefile
Steps:
1. Select the "BankApp" component in the explorer.
2.
Click on the
"Generate" icon in the "C#"
tab of the auxiliary window.
Note: The same operation can be
carried out by clicking on the
icon in the toolbar.
Visualizing the makefile
To visualize a makefile that has been generated, carry out the steps shown in Figure 20.

Figure 20. Visualizing the makefile generated in Figure 19
Steps:
1. Right-click on the compilation work product of the "BankApp".
2. Run the "MDA components/C# Developer/Visualize the makefile" command from the context menu which then appears. The makefile is then displayed.
Note: A generated makefile can
also be visualized by selecting a component's compilation work product and
clicking on the
"Visualize" icon in the
toolbar.
Running compilation
The "Compile" command allows you to compile all the files of a package, using the previously generated makefile. A file containing the compilation results is then produced. This file is used to analyze the compilation results.
To run compilation, carry out the steps shown in Figure 21 below.

Figure 21. Running the "Compile" command for the "BankApp" component
Steps:
1. In the explorer, select the "BankApp" component.
2.
Click on the
icon in the "C#" tab of the
auxiliary window.
Note: The same operation can be
carried out by right-clicking on the C# compilation work product of the "BankApp"
component and running the "C# Developer/Compile" command from
the context menu, or by clicking on the
icon in the toolbar.
Analyzing compilation
After compiling, the compilation analysis window automatically appears (Figure 22).

Figure 22. The "Compilation analysis" window
This window is divided into two sections:
· The upper section displays the generated sources which present errors. Double-clicking on the blue text opens the dialog box of the model element concerned.
·
The lower section, entitled
"Results of the compilation", displays errors prefixed by the
icon. Other lines are prefixed either with the
(information) icon or the
(warning) icon. When selecting a line of
errors, the file containing the faulty code is displayed in the upper section
of the window.