Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我可以删除protobuf net引用的System.Windows.Forms.dll吗_C#_Unity3d_Mono_Protobuf Net - Fatal编程技术网

C# 我可以删除protobuf net引用的System.Windows.Forms.dll吗

C# 我可以删除protobuf net引用的System.Windows.Forms.dll吗,c#,unity3d,mono,protobuf-net,C#,Unity3d,Mono,Protobuf Net,我目前正在努力缩小Unity生产的APK的最终构建尺寸 从Unity编辑器日志中,我发现了一些不必要的DLL文件。最大的一个是System.Windows.Forms.dll,由protobuf-net`引用 层次结构是:protobuf-net->System.ServiceModel->System.Messaging->System.Windows.Forms protobuf net为什么引用windows特定的程序集 如何删除此项?首先,System.Windows.Forms在Uni

我目前正在努力缩小Unity生产的APK的最终构建尺寸

从Unity编辑器日志中,我发现了一些不必要的DLL文件。最大的一个是
System.Windows.Forms.dll,由
protobuf-net`引用

层次结构是:
protobuf-net->System.ServiceModel->System.Messaging->System.Windows.Forms

protobuf net为什么引用windows特定的程序集


如何删除此项?

首先,
System.Windows.Forms
在Unity的情况下实际上不是Windows特有的。Unity在后台使用(微软.NET框架的开源实现),并且完全跨平台。dll的名称为
System.Windows.Forms
,只是为了使Mono与Microsoft的.NET Framework实现兼容

如果你感兴趣,这里有更多的信息

Protobuf net在内部使用
System.Messaging
,这意味着
System.Windows.Forms
也将包括在内。在查看Mono的
System.Messaging
实现的源代码时,我在和中至少看到了对
System.Windows.Forms
的两个引用

同样在Mono的
System.Messaging
的makefile中,您可以看到以下代码:

ifdef NO_WINFORMS_DEPENDENCY
LIB_MCS_FLAGS += -d:NO_WINFORMS_DEPENDENCY
else
LIB_REFS += System.Windows.Forms
endif
总而言之,我认为你无法摆脱这个集会。我对Unity不是很熟悉,但看看protobuf net和Mono的源代码,你需要构建自己的版本,或者做一些魔术来摆脱它

编辑:我想知道Unity是否内置了某种链接或组件剥离机制?例如,在构建一个Android应用程序时,我可以使用一个链接器,它可以从我正在使用的程序集中删除所有未使用的方法、类和其他内容。在您的情况下,protobuf net使用的
System.Windows.Forms
程序集只剩下一小部分


编辑2:可能是需要研究的内容,即使它是特定于iOS的

首先,
System.Windows.Forms
在Unity的例子中实际上并不是特定于Windows的。Unity在后台使用(微软.NET框架的开源实现),并且完全跨平台。dll的名称为
System.Windows.Forms
,只是为了使Mono与Microsoft的.NET Framework实现兼容

如果你感兴趣,这里有更多的信息

Protobuf net在内部使用
System.Messaging
,这意味着
System.Windows.Forms
也将包括在内。在查看Mono的
System.Messaging
实现的源代码时,我在和中至少看到了对
System.Windows.Forms
的两个引用

同样在Mono的
System.Messaging
的makefile中,您可以看到以下代码:

ifdef NO_WINFORMS_DEPENDENCY
LIB_MCS_FLAGS += -d:NO_WINFORMS_DEPENDENCY
else
LIB_REFS += System.Windows.Forms
endif
总而言之,我认为你无法摆脱这个集会。我对Unity不是很熟悉,但看看protobuf net和Mono的源代码,你需要构建自己的版本,或者做一些魔术来摆脱它

编辑:我想知道Unity是否内置了某种链接或组件剥离机制?例如,在构建一个Android应用程序时,我可以使用一个链接器,它可以从我正在使用的程序集中删除所有未使用的方法、类和其他内容。在您的情况下,protobuf net使用的
System.Windows.Forms
程序集只剩下一小部分


编辑2:可能是需要研究的内容,即使它是特定于iOS的

谢谢你的评论!,我将查看protobuf net源代码。谢谢您的评论!,我将检查protobuf网络源代码。