Xamarin.Forms iOS项目无法解决“ System.Runtime.InteropServices.StandardOleMarshalObject”

时间:2018-10-11 20:44:10

标签: c# xamarin xamarin.forms xamarin.ios ios-simulator

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

不仅无法成功构建,而且经常会尝试将其部署到iPhoneSimulator上,只是在尝试在SIM卡上安装应用程序时失败。

这是我遇到的错误:
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 Studio\2017\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 Studio\2017\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 Studio\2017\Enterprise\MSBuild\15.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 Studio\2017\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 ==========

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

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"

Xamarin Simulator - Failed to install

  

{{1}}


注意:我已经尝试了 “仅链接框架SDK” “全部链接” “ 链接行为。

我已经参加了将近2天,请帮忙!

谢谢

1 个答案:

答案 0 :(得分:1)

答案

对于解决问题的方式,我没有确切的答案,但是这是我采取的似乎可以解决的步骤...

  1. 卸载所有项目
  2. 清理了整个解决方案
  3. 重新启动计算机
  4. 重新加载所有项目->然后重建整个解决方案
  5. 将链接行为重新设置为“全部链接” (已重新设置为“仅链接框架SDK”)

问题已解决。