【问题标题】:Xamarin.Forms iOS Project Failed to Resolve "System.Runtime.InteropServices.StandardOleMarshalObject"Xamarin.Forms iOS 项目无法解决“System.Runtime.InteropServices.StandardOleMarshalObject”
【发布时间】:2019-03-17 01:02:44
【问题描述】:

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

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

这是我遇到的错误:
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 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 ==========

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"


注意:我已经尝试过 “仅链接框架 SDK” “链接所有” 链接行为。

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

谢谢

【问题讨论】:

  • 你能告诉我你最近安装或更新了任何 nuget 包,特别是 sqlite
  • @Scarnet 我更新的唯一 Nuget 包是跨 Android/iOS/和 UWP 的 Xamarin.Forms

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


【解决方案1】:

回答

我对解决问题的方法没有明确的答案,但这里是我采取的似乎解决问题的步骤...

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

问题已解决。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-30
    • 1970-01-01
    • 2019-12-23
    • 2015-01-24
    • 2018-03-19
    • 2020-06-04
    • 1970-01-01
    相关资源
    最近更新 更多