[Mono-list] Why do .net compiled apps run without a black dos prompt, and mono apps do?

Jacob Rhoden jacob-lists at uptecs.com
Tue Jun 26 01:55:11 EDT 2007

Hi Guys, Not sure if this list is active, I just subscribed, anyways
quick question.

Why do .net compiled apps run without a black dos prompt, and mono apps do?

Long version:
1) I downloaded a simple example app to show an icon in the system tray.
I just dobule click on the executable and it works (runs under .NET not
2) then I compiled using mono, and then double click on the executable,
and a Black dos prompt opens and stays open during the life of the

How do I compile so that I dont get the dos prompt? I tried compiling in
two different ways. I don't know the difference.

  mcs /r:System.Windows.Forms.dll /r:System.Drawing.dll  SystemTrayApp.cs
  mcs -pkg:dotnet SystemTrayApp.cs

Here is the very simple code:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;

namespace SystemTrayApp {
    public class App {
        private NotifyIcon appIcon = new NotifyIcon();
        private ContextMenu sysTrayMenu = new ContextMenu();
        private MenuItem exitApp = new MenuItem("Exit");

        public void Start() {
            // Configure the system tray icon.
            Icon ico = new Icon("icon.ico");
            appIcon.Icon = ico;
            appIcon.Text = "My .NET Application";

            appIcon.ContextMenu = sysTrayMenu;
            appIcon.Visible = true;

            exitApp.Click += new EventHandler(ExitApp);


        private void ExitApp(object sender, System.EventArgs e) {

        public static void Main() {
            App app = new App();


Jacobs Blog -- http://www.jacobrhoden.com/

More information about the Mono-list mailing list