您好,登錄后才能下訂單哦!
在目錄E:\LiuSen\VS\test下,新建一個Program.cs文件,輸入以下代碼
using System; namespace MyConsoleApp { class Program { static void Main(string[] args) { Console.WriteLine("Hello world!"); Console.ReadKey(); } } }
打開Developer Command Prompt for VS2013,并轉到目錄E:\LiuSen\VS\test下,并使用如下命令進行編譯:
csc.exe /out:Program.exe /t:exe /r:MSCorLib.dll Program.cs
程序運行界面:
MSCorLib.dll is a special file in that it contains all the core types: Byte, Char, String, Int32, and many more. In fact, these types are so frequently used that the C# compiler automatically references the MSCorLib.dll assembly. In other words, the following command line (with the /r switch omitted) gives the same results as the line shown earlier.【MSCorLib.dll是一個經常被引用的類庫,,因此/r MSCorLib.dll參數可以省略】
csc.exe /out:Program.exe /t:exe Program.cs
Furthermore, because the /out:Program.exe and the /t:exe command-line switches also match what the C# compiler would choose as defaults, the following command line gives the same results too.
csc.exe Program.cs
If, for some reason, you really don't want the C# compiler to reference the MSCorLib.dll assembly, you can use the /nostdlib switch. Microsoft uses this switch when building the MSCorLib.dll assembly itself. For example, the following command line will generate an error when CSC.exe attempts to compile the Program.cs file because the System.Console type is defined in MSCorLib.dll.【如果不想讓c# compiler引用MSCore.dll文件,可以加上 /nostdlib參數】
Windows supports three types of applications. To build a console user interface (CUI) application, specify the /t:exe switch; to build a graphical user interface (GUI) application, specify the /t:winexe switch; and to build a Windows Store app, specify the /t:appcontainerexe switch.【在這里,主要注意/t參數的三種類型】
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。