生成、打包、部署和管理应用程序及类型(1):将类型生成到模块中

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace Program1
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             System.Console.WriteLine("Hi");
14         }
15     }
16 }

不要在意这就是个应用程序而已。

该应用程序定义了Program类型,其中有Main的public static方法。Main中引用了另一个System.Console。System.Console是Microsoft实现好的类型。用于实现这个类型的各个方法的IL代码存储在MSCorLib.dll中。

为了生成这个程序,请在环境变量里面配置“C:WindowsMicrosoft.NETFrameworkv4.0.30319”(csc.exe的路径),然后:

 生成Program.exe的可执行文件。Program.exe是标准PE(可移植执行体)文件。也就是说,32和64位Windows都能加载它,并通过它来执行某些操作。Windows支持三种 应用程序:控制台用户界面(/t:exe);图形用户界面(/t:winexe);Windows Store应用(/t:appcontainerexe)。

响应文件

响应文件是包含一组编译器命令行开关的文本文件。执行CSC.exe时,编译器打开响应文件,并使用其中包含的所有开关,就像是这些开关直接在命令行上传递给CSC.exe。

C#编译器支持多个响应文件。除了在命令行上显示指定的文件, 编译器还会自动查找名为CSC.rsp的文件。CSC.exe运行的时候,会在所在目录查找全局的CSC.rsp文件,想应用于自己所有项目的设置应放到其中。

# This file contains command-line options that the C#
# command line compiler (CSC) will process as part
# of every compilation, unless the "/noconfig" option
# is specified. 

# Reference the common Framework libraries
/r:Accessibility.dll
/r:Microsoft.CSharp.dll
/r:System.Configuration.dll
/r:System.Configuration.Install.dll
/r:System.Core.dll
/r:System.Data.dll
/r:System.Data.DataSetExtensions.dll
/r:System.Data.Linq.dll
/r:System.Data.OracleClient.dll
/r:System.Deployment.dll
/r:System.Design.dll
/r:System.DirectoryServices.dll
/r:System.dll
/r:System.Drawing.Design.dll
/r:System.Drawing.dll
/r:System.EnterpriseServices.dll
/r:System.Management.dll
/r:System.Messaging.dll
/r:System.Runtime.Remoting.dll
/r:System.Runtime.Serialization.dll
/r:System.Runtime.Serialization.Formatters.Soap.dll
/r:System.Security.dll
/r:System.ServiceModel.dll
/r:System.ServiceModel.Web.dll
/r:System.ServiceProcess.dll
/r:System.Transactions.dll
/r:System.Web.dll
/r:System.Web.Extensions.Design.dll
/r:System.Web.Extensions.dll
/r:System.Web.Mobile.dll
/r:System.Web.RegularExpressions.dll
/r:System.Web.Services.dll
/r:System.Windows.Forms.Dll
/r:System.Workflow.Activities.dll
/r:System.Workflow.ComponentModel.dll
/r:System.Workflow.Runtime.dll
/r:System.Xml.dll
/r:System.Xml.Linq.dll

  

                                               

原文地址:https://www.cnblogs.com/renzhoushan/p/10355608.html