Xamarin iOS 链接器在 System.Net.Http.Primitives.dll 上失败

Xamarin iOS Linker fails on System.Net.Http.Primitives.dll

在为 Release 构建我的 Xamarin iOS (10.4.0.88) 项目时,如果仅启用 Link SDK 程序集,我会收到以下错误。我有单声道版本 4.8.0.459

C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(694,3): warning : Aot files could not be copied to the destination directory /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/64/Build/Msym/Msym/tmp: Could not start process. 1> --- inner exception 1> System.ComponentModel.Win32Exception (0x80004005): ApplicationName='mono-symbolicate', CommandLine='store-symbols "/Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/bin/iPhone/Release/ServiceOrdersMobileAppsiOS.app.mSYM" "/Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/64/Build/Msym/Msym/tmp"', CurrentDirectory='', Native error= Cannot find the specified file 1> at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0018b] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System.Diagnostics/Process.cs:737 1> --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(694,3): warning : Aot files could not be copied to the destination directory /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/32/Build/Msym/Msym/tmp: Could not start process. 1> --- inner exception 1> System.ComponentModel.Win32Exception (0x80004005): ApplicationName='mono-symbolicate', CommandLine='store-symbols "/Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/bin/iPhone/Release/ServiceOrdersMobileAppsiOS.app.mSYM" "/Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/32/Build/Msym/Msym/tmp"', CurrentDirectory='', Native error= Cannot find the specified file 1> at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0018b] in /private/tmp/source-mono-4.8.0/bockbuild-mono-4.8.0-branch/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/System/System.Diagnostics/Process.cs:737 1> --- 1> Process exited with code 1, command: 1> /Library/Frameworks/Mono.framework/Versions/Current/bin/mono /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5/mono-cil-strip.exe /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/64/Build/System.Net.Http.Primitives.dll /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/bin/iPhone/Release/ServiceOrdersMobileAppsiOS.app/.monotouch-64/System.Net.Http.Primitives.dll 1> Mono CIL Stripper 1> Error: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. 1> Parameter name: index 1> at System.Collections.CollectionBase.System.Collections.IList.get_Item (System.Int32 index) [0x00022] in <12e050e5b3d34326a1b4e2e7624e75da>:0 1> at Mono.Cecil.AssemblyNameReferenceCollection.get_Item (System.Int32 index) [0x00006] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.ReflectionReader.GetExportedTypeScope (Mono.Cecil.Metadata.MetadataToken scope) [0x00043] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.ReflectionReader.VisitExternTypeCollection (Mono.Cecil.ExternTypeCollection externs) [0x00089] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AggressiveReflectionReader.ReadExternTypes () [0x0000c] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AggressiveReflectionReader.VisitTypeDefinitionCollection (Mono.Cecil.TypeDefinitionCollection types) [0x0004f] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.ReflectionReader.VisitModuleDefinition (Mono.Cecil.ModuleDefinition mod) [0x00007] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.StructureReader.TerminateAssemblyDefinition (Mono.Cecil.AssemblyDefinition asm) [0x00034] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AssemblyDefinition.Accept (Mono.Cecil.IReflectionStructureVisitor visitor) [0x0001f] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader irv, System.Boolean manifestOnly) [0x00014] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader reader) [0x00000] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.Cecil.AssemblyFactory.GetAssembly (System.String file) [0x00006] in <515b8343d4d0423f92114dba6b015690>:0 1> at Mono.CilStripper.Program.Main (System.String[] args) [0x00029] in <515b8343d4d0423f92114dba6b015690>:0 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(694,3): error : Could not strip assembly /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/64/Build/System.Net.Http.Primitives.dll. 1> --- inner exception 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(694,3): error : Could not strip assembly /Users/markmeyer/Library/Caches/Xamarin/mtbs/builds/ServiceOrdersMobileApps.iOS/295315d462497600265210bd6b0fdce2/obj/iPhone/Release/mtouch-cache/64/Build/System.Net.Http.Primitives.dll. 1> --- 1> at MonoTouch.Tuner.Stripper.Process (System.String assembly_file, System.String output_file) [0x000ba] in /Users/builder/data/lanes/3985/9975cb17/source/xamarin-macios/tools/mtouch/Stripper.cs:33 1> at Xamarin.Bundler.Target.m__2 (Xamarin.Bundler.Assembly assembly) [0x00065] in /Users/builder/data/lanes/3985/9975cb17/source/xamarin-macios/tools/mtouch/Target.cs:1041 1> at System.Threading.Tasks.Parallel+c__AnonStorey62[TSource,TLocal].<>m__0 (System.Int32 i) [0x00012] in <12e050e5b3d34326a1b4e2e7624e75da>:0 1> at System.Threading.Tasks.Parallel+<ForWorker>c__AnonStorey31[TLocal].<>m__1 () [0x000ed] in <12e050e5b3d34326a1b4e2e7624e75da>:0

我有以下额外的 mtouch 参数

-cxx -gcc_flags "-lc++" -v -v -v -v

如果我关闭链接器,一切都会构建并且工作正常。我需要链接器才能让我的应用程序获得应用程序商店的批准,因为它会删除我不需要的东西(例如 CallKit)。有什么建议吗?

我遇到了同样的问题,刚刚找到了解决方案。这似乎是 Xamarin iOS (10.4) 和 mono 框架当前测试版的问题。

假设您不在 Xamarin 的稳定频道上:

在 Mac 上打开 Xamarin Studio,然后从主菜单中单击检查更新。切换回稳定频道并将 Mono Framework 和 Xamarin iOS 版本降级到当前版本。

这样做之后,我能够使用 Xamarin Studio 启用链接来构建应用存档,以便在应用商店中发布。

如果您一直在使用 Visual Studio 进行 Mac 预览,此版本的 Mono Framework 与其不兼容,因此您必须坚持使用 Xamarin Studio 或 Visual Studio 在 Windows.