为什么 Visual Studio 中尚未添加 System.Design.dll 的引用?
当我尝试使用“System.Windows.Form.Design”命名空间时,我必须始终在新项目中添加引用。有人可以告诉我吗?
When I trying to use "System.Windows.Form.Design" namespace, I have to add reference all the time in new project. Can any tell me about it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您在 Visual Studio 中创建不同的项目时,它会默认添加不同的 BCL 程序集作为引用。
System.Design.dll
不是其中之一,因为标准应用程序/开发人员不常用它。设计师就是这样决定的。您可以创建自己的项目类型,其中已包含引用,然后将其导出为项目模板。When you create different projects in Visual Studio it adds by default different BCL assemblies as references.
System.Design.dll
is not one of them as it is not commonly used by standard apps / developers. That's how the designers decided. You could create your own project type which will already contain the reference and then export it as project template.仅在常规 .NET 中就有大量可用的 dll,其工具涵盖了广泛的技术领域 - 这是在您添加任何外部库之前的情况。您不会希望项目中包含所有可用的 .NET 框架 dll - 坦率地说,这会让您眼睛起泡。 IDE 添加了一个小集,旨在涵盖:
在4.0 ,支持某些语言功能的库(
动态
等)您完全有可能需要更多参考资料 - 但哪些参考资料取决于您要写的内容 - 例如,您可能需要 EF,或者您可能需要 RSS -处理等。您也可以选择如果您实际上没有使用它们,请删除一些默认的引用(尽管请注意,这不会影响结果,因为 C# 编译器会自动删除未使用的引用 - 这只是为了整齐的)。像 resharper 这样的工具可以在这方面提供帮助,当您输入它可以识别的类型名称(但当前无法解析)时,可以添加
using
指令和引用)。There are masses of dlls available just in regular .NET, with tools to cover a wide range of technology niches - and that is before you add any external libraries. You wouldn't want all the available .NET framework dlls in your project - it would, frankly, make your eyes blister. The IDE adds a small set designed to cover:
dynamic
etc)It is entirely likely that you will need more references - but which references depends on what you are going to write - for example, you might need EF, or you might need RSS-handling, etc. You might also choose to remove a few of the default ones, if you aren't actually using them (although note that this doesn't affect the result, as the C# compiler will drop unused references automatically - this is just to be tidy).
Tools like resharper can help here, by offering to add both the
using
directive and the reference when you enter a type-name that it recognises (but which doesn't currently resolve).