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

Miguel de Icaza miguel at novell.com
Mon Jun 25 22:27:49 EDT 2007


> 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

Pass the flag -target:winexe to the compiler

Miguel.

> 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";
> 
>             sysTrayMenu.MenuItems.Add(exitApp);
>             appIcon.ContextMenu = sysTrayMenu;
>             appIcon.Visible = true;
> 
>             exitApp.Click += new EventHandler(ExitApp);
> 
>         }
> 
>         private void ExitApp(object sender, System.EventArgs e) {
>             Application.Exit();
>         }
> 
>         public static void Main() {
>             App app = new App();
>             app.Start();
>             Application.Run();
>         }
>     }
> 
> }
> 
> 


More information about the Mono-list mailing list