2010-04-01 2 views
0

Visual Studio 없이도 작은 창 양식 응용 프로그램을 만들어 놀았습니다.NAnt 컴파일 창 양식 응용 프로그램을 만들 때 표시되는 명령 창 방지

메모장에서 소스를 만들고 ++ 빌드 파일로 컴파일하십시오.

응용 프로그램을 실행하면 명령 창이 표시되고 응용 프로그램 창이 표시됩니다. 명령 창을 표시하지 않으려면 어떻게합니까?

using System; 
using System.Drawing; 
using System.Windows.Forms; 
using System.Media; 
using System.IO; 

namespace mynamespace 
{ 
    class MyForm : Form 
    { 
     public Button btnPlay; 

     MyForm() 
     { 
      this.SuspendLayout(); 

      this.Text = "My Application"; 

      InitialiseForm();  

      this.ResumeLayout(false); 
     } 

     private void InitialiseForm() 
     { 
      btnPlay = new Button(); 
      btnPlay.Location = new System.Drawing.Point(30,40); 
      btnPlay.Text = "Play"; 
      btnPlay.Click += new System.EventHandler(btnPlay_Click); 

      this.Controls.Add(btnPlay); 
     } 

     protected void btnPlay_Click(object sender, EventArgs e) 
     { 
      string wav = "testing123.wav"; 
      Stream resourceStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(wav); 
      SoundPlayer player = new SoundPlayer(resourceStream); 
      player.Play(); 
     } 

     public static void Main() 
     { 
      Application.Run(new MyForm()); 
     } 
    } 
} 

빌드 파일

<?xml version="1.0"?> 
<project name="myform" default="build" basedir="."> 
    <description>My Form app</description> 
    <property name="debug" value="true" overwrite="false"/> 
    <target name="clean" description="Remove all generated files"> 
     <delete dir="build"/> 
    </target> 
    <target name="build" description="Compile the source" depends="clean"> 
     <mkdir dir="build"/> 
     <csc target="exe" output="build\MyForm.exe" debug="${debug}" verbose="true"> 
      <resources> 
       <include name="app\resources\*.wav" /> 
      </resources> 
      <sources> 
       <include name="app\MyForm.cs"/> 
      </sources> 
     </csc> 
    </target> 
</project> 

답변

2

내가, 내가 대신 대상 = "EXE"

를 대상 = "winexe를"을 지정 할 필요가있다 확인