2010-11-30 42 views
1

.exe不包含適用於入口點的靜態「Main」方法。如何在Visual Studio中啓動對象

爲此,我已經到了應用程序選項卡上的項目屬性,然後啓動對象,但它告訴我,它沒有設置,我不能像frmMain一樣進入我的程序。

如何在啓動對象上輸入程序?

+8

我想你需要一個main方法 – JaredPar 2010-11-30 20:22:40

回答

4

創建一個新的源代碼文件(可能將其命名爲「Program.cs」)。在這個文件中,插入這樣的事情:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 

namespace MyApplication 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      Console.WriteLine("Hello World!"); 
      Console.WriteLine("* Press Any Key to Exit *"); 
      Console.ReadKey(); 
     } 
    } 
} 
相關問題