Xamarin.Forms iOS 项目未能解决 "System.Runtime.InteropServices.StandardOleMarshalObject"

Xamarin.Forms iOS Project Failed to Resolve "System.Runtime.InteropServices.StandardOleMarshalObject"

更新到 Xcode 10.0(在 Mac 上)和 Xamarin.Forms v3.2.0.871581(在 Mac/PC),我无法再成功构建我的 Forms.iOS 项目。

它不仅没有成功构建,而且经常会尝试部署到 iPhoneSimulator,但在尝试在 sim 上安装应用程序时却失败了。

这是我遇到的错误:
Failed to resolve "System.Runtime.InteropServices.StandardOleMarshalObject" reference from "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

这是完整的崩溃日志输出:

1>------ Rebuild All started: Project: EISPocketJMS4.iOS, Configuration: Debug iPhoneSimulator ------
1>  Connecting to Mac server 192.168.1.165...
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\Xamarin.Sdk.targets(66,3): warning MSB3491: Could not write lines to file "obj\iPhoneSimulator\Debug\_TelemetryProps". Could not find a part of the path 'C:\Users\zach\Desktop\EISPocketJMS4_Solution\EISPocketJMS4\EISPocketJMS4.iOS\obj\iPhoneSimulator\Debug\_TelemetryProps'.
1>  Connecting to Mac server 192.168.1.165...
1>  No way to resolve conflict between "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Numerics, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089". Choosing "System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1>  No way to resolve conflict between "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.
1>  Consider app.config remapping of assembly "System.Numerics, Culture=neutral, PublicKeyToken=b77a5c561934e089" from Version "2.0.5.0" [C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.iOS\v1.0\System.Numerics.dll] to Version "4.0.0.0" [C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll] to solve conflict and get rid of warning.
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3276: Found conflicts between different versions of the same dependent assembly. Please set the "AutoGenerateBindingRedirects" property to true in the project file. For more information, see http://go.microsoft.com/fwlink/?LinkId=294190.
1>C:\Users\zach\Desktop\EISPocketJMS4_Solution\EISPocketJMS4\EISPocketJMS4\Globals.cs(124,40,124,59): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
1>  EISPocketJMS4.iOS -> C:\Users\zach\Desktop\EISPocketJMS4_Solution\EISPocketJMS4\EISPocketJMS4.iOS\bin\iPhoneSimulator\Debug\EISPocketJMS4.iOS.exe
1>  Detected signing identity:
1>    Provisioning Profile: "iOS Team Provisioning Profile: *" ([removed for privacy])
1>    Bundle Id: com.eis.EISPocketJMS4
1>    App Id: DH32F99JXP.com.eis.EISPocketJMS4
1>C:\Program Files (x86)\Microsoft Visual Studio17\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(794,3): error MT2002: Failed to resolve "System.Runtime.InteropServices.StandardOleMarshalObject" reference from "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Xamarin Simulator - Failed to install

Failed to install //Users/ZachAibrary/Caches/Xamarin/mtbs/builds/EISPocketIMS4.iOS/1afdfObe9e0c1d15a5f8dfb4597 4398e/bin/iPhoneSimulator/Debug/EISPocketIMS4.i0S.app to 15C32787-E053AFCA-8598-D07E93B37640. Failed to launch the simulator. Could not find file "/Users/ZachAibrary/Caches/Xamarin/mtbs/builds/EISPocketiMS4.OS/1afdfObe9e0c1d15a5f8dfb45974398e/bin/iPhoneSimulator/Debug/EISPock etIMS4.i0S.app/EISPocketIMS4.i0S"


注意:"Link Framework SDKs Only"和[=47我都试过了=] "Link All" 链接行为。

我已经研究了将近 2 天了,请帮忙!

谢谢

回答

对于解决问题的原因,我没有明确的答案,但以下是我采取的似乎可以解决问题的步骤...

  1. 已卸载所有项目
  2. 清理了整个解决方案
  3. 重启电脑
  4. 重新加载所有项目 -> 然后重建整个解决方案
  5. 将链接行为重新设置为 "Link All" (已设置回 "Link Framework SDKs Only")

问题已解决。