How to Deploy .Net Applications to the Linux Platform With Confidence Using Mono With Delphi Prism

.NET since inception has captivated developers across the world, with its simplicity in terms of development, and flexibility of deployment of Enterprise Class Applications. Today, Windows applications are reaching new frontiers in the...
Method 1 of 3:

Setting Up

  1. Install Delphi Prism XE after downloading, in the same manner you would install any Windows Application.
  2. Set up the VM. Launch VMware Player / VirtualBox and create an OpenSuSe based VM. Install the ISO that you downloaded from the location.
  3. Boot off the Live CD then choose Install. The recommended install is to have a Swap Space of twice your Physical Memory and the remaining can be allocated to / (root) partition.
  4. Once installed, reboot the VM and login with your credentials.
Method 2 of 3:

Building a Simple Notepad Application in Delphi Prism and Deploying it to the Mono Appliance

  1. Launch Delphi Prism by clicking on Start --> All Programs --> Delphi Prism in Visual Studio 2010. Ensure that you run Visual Studio as an Administrator.
  2. Click on File --> New Project and choose Windows Forms Applications (Mono), under the Mono section.
  3. From the Toolbox --> Drag and Drop the following controls onto the Form:
    1. MenuStrip
    2. ToolStrip
    3. StatusStrip
    4. StatusStrip
    5. ContextMenuStrip
    6. RichTextBoxControl
  4. For the MenuStrip and ToolStrip controls, set to insert standard items. Dock the Rich Textbox Control.
  5. For the ContextStrip Menu, add the following three items:
    1. Cut
    2. Copy
    3. Paste
  6. Write some code to implement a simple Cut, Copy and Paste functionality.

    [Cut Action]

    method Mainform.cutToolStripMenuItem1_Click(sender: System.Object; e:
    System.EventArgs);
    begin
    richTextBox1.Cut;

    end;

    [Copy Action]

    method MainForm.copyToolStripMenuItem1_Click(sender: System.Object; e:
    System.EventArgs);
    begin
    richTextBox1.Copy;

    end;

    [Paste Action]

    method MainForm.pasteToolStripMenuItem1_Click(sender: System.Object; e:
    System.EventSrgs);
    begin
    richTextBox1.Paste;

    end;

    end.
  7. Bind the ContextMenuStrip to the Rich Textbox and copy and paste the above code for the respective actions, in the ContextMenu Strip.
  8. Press F5 and run the Application.
  9. Type some text and right click to launch the Context Menu.
  10. Verify that you are able to perform the required functions, and close the application.
Method 3 of 3:

Deploying the SimpleNotepad to Linux

  1. As you have the Mono Appliance running, ensure that VMWare Tools are installed on it.
  2. Navigate to the Debug folder of your project. The path would be similar to something as shown below:

    C:UsersUsernameDocumentsvisual studio 2010ProjectsSimple NotepadSimple NotepadbinDebug
  3. Copy the Simple_Notepad.exe to the Mono Appliance Desktop.
  4. Ensure that the Application does not have any dependencies in running successfully within the Mono Environment. To test this, click on Computer, and choose MOMA - Mono Migration Analyzer.
  5. Click Next to continue.
  6. Click on the (+) button and add the Simple_Notepad.exe to the Analyzer.
  7. Click Next to continue. It will start scanning the assemblies, needed for a successful launch.
  8. You would be able to see whether the MOMA tool has found any errors or success rate.
  9. Launch a Terminal window, and run the following command:

    mono Simple_Notepad.exe
  10. After running, you can see the application running without any problems.
4 ★ | 1 Vote