c# - 不需要引用 windows.forms 程序集?

标签 c#

书上说了一个小的 Windows.Forms 程序

The Windows Forms classes are in the System.Windows.Forms assembly, which is the System.Windows.Forms.dll file. To compile this program you need a reference to that assembly.When compiling on the command line, use the /r switch to specify other assemblies.

但我可以从命令行 (csc.exe) 编译该程序,无需引用任何程序集。这是为什么?

最佳答案

csc 默认添加对一堆程序集的引用。查看与 csc.exe 相同的目录中的 csc.rsp(例如 c:\Windows\Microsoft.NET\Framework\v3.5)以查看引用的内容默认情况下。

您可以指定自己的 response file用这样的@:

csc @responses.txt Foo.cs Bar.cs

(诚然,这不是经常有用...)

您还可以防止默认响应文件与 /noconfig switch 一起使用.

关于c# - 不需要引用 windows.forms 程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2356180/

相关文章:

c# - 突破 C# 实例化批处理脚本来获取 shell?

c# mvc jquery 实时聊天

链接到解决方案配置的 C# 预处理器指令

C# 如何通过分组解析文本文件?

c# - 运行时错误:LINQ to Entities无法识别“User.IsInRole()”上的方法

c# - 在 .NET 中,异步方法是专门使用 async 关键字的方法吗?

c# - "VsTsc"任务无法用其输入 > 参数初始化

c# - 如何从字符串内容中删除一些特殊的单词?

c# - HTTPS文件下载C#

c# - 地理数据网络服务