如果我使用“仅链接 SDK”构建我的应用程序以进行发布构建(用于在没有 Mono 的机器上进行 beta 测试),它不再启动 - 它似乎立即崩溃。
如果我运行我的应用程序命令行,这是崩溃:
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: An exception was thrown by the type initializer for System.Xml.Serialization.XmlSerializer ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Default constructor not found for type System.Configuration.ExeConfigurationHost.
at System.Activator.CreateInstance (System.Type type, Boolean nonPublic) [0x00000] in <filename unknown>:0
at System.Activator.CreateInstance (System.Type type) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationSystem.Init (System.Type typeConfigHost, System.Object[] hostInitParams) [0x00000] in <filename unknown>:0
at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.OpenExeConfigurationInternal (ConfigurationUserLevel userLevel, System.Reflection.Assembly calling_assembly, System.String exePath) [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Configuration.ClientConfigurationSystem.get_Configuration () [0x00000] in <filename unknown>:0
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Configuration.ConfigurationSettings.GetConfig (System.String sectionName) [0x00000] in <filename unknown>:0
at System.Xml.Serialization.XmlSerializer..cctor () [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
有什么方法可以在这里添加适当的[Preserve]
属性吗?或者也许强制链接器保留这个类?
更多信息:
- 我的应用是一个MonoGame游戏,名为Draw a Stickman: EPIC
- 如果我不链接任何程序集,它运行得很好,但我的应用程序要大 10MB
- 最初我从带有 Tao.Sdl.dll 的链接器中得到了一些错误,但我在我的主项目中引用了它,并修复了它。
- 我的目标是 10.6 及更高版本