在目錄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.dllis 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/nostdlibswitch. 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 supportsthree types of applications. To build a console user interface (CUI) application, specify the/t:exeswitch; to build a graphical user interface (GUI) application, specify the/t:winexeswitch; and to build a Windows Store app, specify the/t:appcontainerexeswitch.【在這里,主要注意/t參數(shù)的三種類型】
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務(wù)器,動(dòng)態(tài)BGP最優(yōu)骨干路由自動(dòng)選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務(wù)部署。公司持有工信部辦法的idc、isp許可證, 機(jī)房獨(dú)有T級流量清洗系統(tǒng)配攻擊溯源,準(zhǔn)確進(jìn)行流量調(diào)度,確保服務(wù)器高可用性。佳節(jié)活動(dòng)現(xiàn)已開啟,新人活動(dòng)云服務(wù)器買多久送多久。