MonoTouch 链接器无法解析 System.Void System.Console::set_ForegroundColor(System.ConsoleColor)

发布于 2025-01-06 18:05:25 字数 1828 浏览 1 评论 0原文

我的应用程序可以很好地构建/链接/部署到模拟器,但我只是第一次尝试将应用程序构建/部署到真实设备,然后出现链接器失败。

我不在应用程序中的任何地方使用 System.ConsoleConsoleColor,但我确实有相当多的代码使用 UIColor,并且我想知道这里是否存在一些 MT 依赖性。

我正在使用最新的东西 - MonoDevelop 2.8.6.5 和 MonoTouch 5.2.5。

编译为本机代码 /Developer/MonoTouch/usr/bin/mtouch -sdkroot “/Developer”-v --nomanifest --nosign -dev “/Users/ogazit/zaplify/bin/iPhone/Debug/iphone.app”-r “/Users/ogazit/zaplify/bin/iPhone/Debug/BuiltSteady.Zaplify.Devices.ClientEntities.dll” -r“/Users/ogazit/zaplify/bin/iPhone/Debug/Utilities.dll”-r“/Users/ogazit/zaplify/bin/iPhone/Debug/BuiltSteady.Zaplify.Devices.ClientViewModels.dll” -r“/Developer/MonoTouch/usr/lib/mono/2.1/System.dll”-r“/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll”-r “/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll”-r “/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll”-r “/Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll”-debug -profiling -linksdkonly -sdk“5.0”“/Users/ogazit/zaplify/bin/iPhone/Debug/zaplifyiphone.exe”MonoTouch 5.2.5版本使用框架: /开发者/平台/iPhoneOS.platform/开发者/SDKs/iPhoneOS5.0.sdk 将 /Users/ogazit/zaplify/bin/iPhone/Debug/zaplifyiphone.exe 复制到 /Users/ogazit/zaplify/bin/iPhone/Debug/iphone.app/zaplifyiphone.exe 复制/Users/ogazit/zaplify/bin/iPhone/Debug/SharpCompress.3.5.dll 到 /Users/ogazit/zaplify/bin/iPhone/Debug/iphone.app/SharpCompress.3.5.dll 已复制 /Users/ogazit/zaplify/bin/iPhone/Debug/Newtonsoft.Json.MonoTouch.dll 到 /Users/ogazit/zaplify/bin/iPhone/Debug/iphone.app/Newtonsoft.Json.MonoTouch.dll 链接SDK仅用于组装 /Users/ogazit/zaplify/bin/iPhone/Debug/zaplifyiphone.exe 进入 /Users/ogazit/zaplify/bin/iPhone/Debug/iphone.app 错误 MT2002:可以 无法解析参考:System.Void System.Console::set_ForegroundColor(System.ConsoleColor)

My app builds/links/deploys fine to the simulator, but I just tried to build/deploy the app to a real device for the first time, and I get a linker failure.

I don't use System.Console or ConsoleColor anywhere in my app, but I do have a fair amount of code that uses UIColor, and I wonder if there's some MT dependency here.

I'm using the latest stuff - MonoDevelop 2.8.6.5 and MonoTouch 5.2.5.

Compiling to native code /Developer/MonoTouch/usr/bin/mtouch -sdkroot
"/Developer" -v --nomanifest --nosign -dev
"/Users/ogazitt/zaplify/bin/iPhone/Debug/iphone.app" -r
"/Users/ogazitt/zaplify/bin/iPhone/Debug/BuiltSteady.Zaplify.Devices.ClientEntities.dll"
-r "/Users/ogazitt/zaplify/bin/iPhone/Debug/Utilities.dll" -r "/Users/ogazitt/zaplify/bin/iPhone/Debug/BuiltSteady.Zaplify.Devices.ClientViewModels.dll"
-r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r
"/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r
"/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r
"/Developer/MonoTouch/usr/lib/mono/2.1/MonoTouch.Dialog-1.dll" -debug
-profiling -linksdkonly -sdk "5.0" "/Users/ogazitt/zaplify/bin/iPhone/Debug/zaplifyiphone.exe" MonoTouch
version 5.2.5 using framework:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
Copied /Users/ogazitt/zaplify/bin/iPhone/Debug/zaplifyiphone.exe to
/Users/ogazitt/zaplify/bin/iPhone/Debug/iphone.app/zaplifyiphone.exe
Copied /Users/ogazitt/zaplify/bin/iPhone/Debug/SharpCompress.3.5.dll
to
/Users/ogazitt/zaplify/bin/iPhone/Debug/iphone.app/SharpCompress.3.5.dll
Copied
/Users/ogazitt/zaplify/bin/iPhone/Debug/Newtonsoft.Json.MonoTouch.dll
to
/Users/ogazitt/zaplify/bin/iPhone/Debug/iphone.app/Newtonsoft.Json.MonoTouch.dll
Linking SDK only for assembly
/Users/ogazitt/zaplify/bin/iPhone/Debug/zaplifyiphone.exe into
/Users/ogazitt/zaplify/bin/iPhone/Debug/iphone.app error MT2002: Can
not resolve reference: System.Void
System.Console::set_ForegroundColor(System.ConsoleColor)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

往事随风而去 2025-01-13 18:05:25

这很可能是您的程序集依赖项之一包含对 System.Console.ForegroundColor 属性和 System.ConsoleColor 类型的引用。

这在模拟器下有效,因为在这种情况下使用了 JIT(及时)编译器(更快的构建),并且如果执行从未到达 ConsoleColor 代码,那么您将永远不会看到它丢失MonoTouch 的 mscorlib.dll

但是,当您为设备构建 MonoTouch 时,需要使用 AOT(提前)编译器(因为 Apple 不允许 在 iOS 设备上允许 JIT)。这意味着所有内容(即使您在执行时不会使用它)都需要编译为本机代码。任何缺失,例如 ConsoleColor,都会导致错误。

如果您不确定哪个程序集具有引用,只需打开错误报告并附加每个 .dll 和您的 .exe(您可以将附件标记为私有),我们将帮助您识别该程序集。

That's very likely that one of your assembly dependencies that contains a reference to both System.Console.ForegroundColor property and System.ConsoleColor type.

This works under the simulator because the JIT (just in time) compiler is used in this case (faster builds) and, if the execution never reach the ConsoleColor code, then you'll never see it's missing from MonoTouch's mscorlib.dll.

However when you build for device MonoTouch needs to use the AOT (ahead of time) compiler (because Apple does not allow JIT'ing on iOS devices). This means everything (even if you would not use it at execution time) needs to be compiled to native code. Anything missing, like ConsoleColor, will result in an error.

If you're unsure which assembly has the reference just open a bug report an attach every .dll and your .exe (you can mark the attachment as private) and we'll help you identify the assembly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文