System.Web.dll引用System.Windows.Forms?

时间:2021-01-07 20:37:25

I heard from a friend that asp.net relies on/uses a Windows forms class. I tried to figure out which class that might be.

我从朋友那里听说asp.net依赖/使用Windows表单类。我试图找出可能是哪一堂课。

The only class I found was System.Web.UI.WebControls.FontInfo
with the property public string[] Names
that has an Attribute Editor("System.Windows.Forms.Design.StringArrayEditor--snip")

我找到的唯一一个类是System.Web.UI.WebControls.FontInfo,其属性为public string []具有属性编辑器的名称(“System.Windows.Forms.Design.StringArrayEditor - snip”)

Is there a reference to the Windows.Forms.dll from System.Web.dll?

是否有来自System.Web.dll的Windows.Forms.dll的引用?

5 个解决方案

#1


I think there is a reference from System.Web, Version 2.0.0.0 to System.Windows.Forms.

我认为System.Web,Version 2.0.0.0和System.Windows.Forms都有一个引用。

Check out System.Web.Compilation.ResXBuildProvider.GetResourceReader(Stream) in Reflector.
On line one: ResXResourceReader reader = new ResXResourceReader(inputStream); ResXResourceReader is from System.Windows.Forms, Version 2.0.0.0

查看Reflector中的System.Web.Compilation.ResXBuildProvider.GetResourceReader(Stream)。第一行:ResXResourceReader reader = new ResXResourceReader(inputStream); ResXResourceReader来自System.Windows.Forms,版本2.0.0.0

I was curious because I noticed System.Windows.Forms in the loaded modules window in Visual Studio.

我很好奇,因为我在Visual Studio的已加载模块窗口中注意到了System.Windows.Forms。

ildasm System.web.dll /out =System.Web.il let me quickly search for System.Windows.Forms references. I couldn’t quickly figure out a way to do it from reflector.

ildasm System.web.dll / out = System.Web.il让我快速搜索System.Windows.Forms引用。我无法从反射器中快速找到一种方法。

#2


There is no reference, and not System.Windows.Forms either.

没有引用,也没有System.Windows.Forms。

The StringArrayEditor is a UITypeEditor in the System.Design assembly. This does not get loaded unless used except at design time, when it will be 'lazy-loaded'.

StringArrayEditor是System.Design程序集中的UITypeEditor。除非在设计时使用,否则它将被加载,否则它将被“加载延迟”。

#3


First of all, I am not sure such an existence.

首先,我不确定这样的存在。

But Namespace or classname doesn't necessary mean you need a reference to Windows.Forms.dll. You can define "System.Windows.Forms.Design.StringArrayEditor" in an assembly outside Windows.Forms.dll.

但Namespace或classname并不一定意味着您需要对Windows.Forms.dll的引用。您可以在Windows.Forms.dll外部的程序集中定义“System.Windows.Forms.Design.StringArrayEditor”。

#4


If you look at the System.Web assembly in the handy Reflector tool, you will see that there is indeed a reference from System.Web to System.Windows.Forms. However, if you use one of the plugins for Reflector that will export the reverse engineered code to files (e.g. FileGenerator), and then search through that, there is no actual use of System.Windows.Forms. Since the .Net runtime will only load assemblies when they are actually needed, the WinForms assembly should never actually be loaded through any usage of System.Web.

如果您在方便的Reflector工具中查看System.Web程序集,您将看到确实存在从System.Web到System.Windows.Forms的引用。但是,如果您使用Reflector的其中一个插件将反向工程代码导出到文件(例如FileGenerator),然后搜索它,则不会实际使用System.Windows.Forms。由于.Net运行时只在实际需要时加载程序集,因此永远不应该通过任何System.Web的使用来加载WinForms程序集。

#5


Add me to the list of skeptics. But more importantly, it doesn't matter. The way the .Net framework is set up for linking adding or removing a dependance on any of the core assemblies that ship with the framework won't really impact performance in any meaningful way.

将我加入怀疑论者名单。但更重要的是,这无关紧要。 .Net框架的设置方式,用于链接添加或删除与框架一起提供的任何核心程序集的依赖性,这不会以任何有意义的方式影响性能。

#1


I think there is a reference from System.Web, Version 2.0.0.0 to System.Windows.Forms.

我认为System.Web,Version 2.0.0.0和System.Windows.Forms都有一个引用。

Check out System.Web.Compilation.ResXBuildProvider.GetResourceReader(Stream) in Reflector.
On line one: ResXResourceReader reader = new ResXResourceReader(inputStream); ResXResourceReader is from System.Windows.Forms, Version 2.0.0.0

查看Reflector中的System.Web.Compilation.ResXBuildProvider.GetResourceReader(Stream)。第一行:ResXResourceReader reader = new ResXResourceReader(inputStream); ResXResourceReader来自System.Windows.Forms,版本2.0.0.0

I was curious because I noticed System.Windows.Forms in the loaded modules window in Visual Studio.

我很好奇,因为我在Visual Studio的已加载模块窗口中注意到了System.Windows.Forms。

ildasm System.web.dll /out =System.Web.il let me quickly search for System.Windows.Forms references. I couldn’t quickly figure out a way to do it from reflector.

ildasm System.web.dll / out = System.Web.il让我快速搜索System.Windows.Forms引用。我无法从反射器中快速找到一种方法。

#2


There is no reference, and not System.Windows.Forms either.

没有引用,也没有System.Windows.Forms。

The StringArrayEditor is a UITypeEditor in the System.Design assembly. This does not get loaded unless used except at design time, when it will be 'lazy-loaded'.

StringArrayEditor是System.Design程序集中的UITypeEditor。除非在设计时使用,否则它将被加载,否则它将被“加载延迟”。

#3


First of all, I am not sure such an existence.

首先,我不确定这样的存在。

But Namespace or classname doesn't necessary mean you need a reference to Windows.Forms.dll. You can define "System.Windows.Forms.Design.StringArrayEditor" in an assembly outside Windows.Forms.dll.

但Namespace或classname并不一定意味着您需要对Windows.Forms.dll的引用。您可以在Windows.Forms.dll外部的程序集中定义“System.Windows.Forms.Design.StringArrayEditor”。

#4


If you look at the System.Web assembly in the handy Reflector tool, you will see that there is indeed a reference from System.Web to System.Windows.Forms. However, if you use one of the plugins for Reflector that will export the reverse engineered code to files (e.g. FileGenerator), and then search through that, there is no actual use of System.Windows.Forms. Since the .Net runtime will only load assemblies when they are actually needed, the WinForms assembly should never actually be loaded through any usage of System.Web.

如果您在方便的Reflector工具中查看System.Web程序集,您将看到确实存在从System.Web到System.Windows.Forms的引用。但是,如果您使用Reflector的其中一个插件将反向工程代码导出到文件(例如FileGenerator),然后搜索它,则不会实际使用System.Windows.Forms。由于.Net运行时只在实际需要时加载程序集,因此永远不应该通过任何System.Web的使用来加载WinForms程序集。

#5


Add me to the list of skeptics. But more importantly, it doesn't matter. The way the .Net framework is set up for linking adding or removing a dependance on any of the core assemblies that ship with the framework won't really impact performance in any meaningful way.

将我加入怀疑论者名单。但更重要的是,这无关紧要。 .Net框架的设置方式,用于链接添加或删除与框架一起提供的任何核心程序集的依赖性,这不会以任何有意义的方式影响性能。