您好,登錄后才能下訂單哦!
在目錄E:\LiuSen\VS\test下,新建一個(gè)Program.cs文件,輸入以下代碼
using System; namespace MyConsoleApp { class Program { static void Main(string[] args) { Console.WriteLine("Hello world!"); Console.ReadKey(); } } }
打開Developer Command Prompt for VS2013,并轉(zhuǎn)到目錄E:\LiuSen\VS\test下,并使用如下命令進(jìn)行編譯:
csc.exe /out:Program.exe /t:exe /r:MSCorLib.dll Program.cs
程序運(yùn)行界面:
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是一個(gè)經(jīng)常被引用的類庫,,因此/r MSCorLib.dll參數(shù)可以省略】
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參數(shù)】
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參數(shù)的三種類型】
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。