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

Alan McGovern alan.mcgovern at gmail.com
Mon Jul 2 13:55:55 EDT 2007


compile with:

/target:WinExe  (or something like that).

Alan.

On 6/26/07, Jacob Rhoden <jacob at rhoden.id.au> wrote:
>
> 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
> mono).
> 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
> application.
>
> 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";
>
>             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();
>         }
>     }
>
> }
>
>
> --
> _________________________________________________
> Jacob Rhoden
> Application Architect
> Systems Development and Integration
> University of Melbourne
>
> Phone: +61 3 8344 2884
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070702/ca620db1/attachment-0001.html 


More information about the Mono-list mailing list