【问题标题】:Windows 10 IoT ARM (Raspberry Pi) System.Threading - missing referencesWindows 10 IoT ARM (Raspberry Pi) System.Threading - 缺少参考
【发布时间】:2017-06-02 12:42:38
【问题描述】:

我正在尝试为 Raspberry Pi 2 编译 UWP C# 解决方案。 这是project.json

{
 "dependencies": {
  "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
},
"frameworks": {
    "uap10.0": {
    "imports": [
     ]
    }
},
"runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
    }
}

问题是我引用(通过 dll,我无法通过对项目的正常引用添加它)到另一个项目,该项目使用 System.Threading 进行一些线程操作。这是project.json

{
"version": "1.0.0-*",

"dependencies": {
  "ELMSDefinitionsCore": "1.0.0-*",
  "NETStandard.Library": "1.6.1",
  "System.ComponentModel.Primitives": "4.2.0",
  "System.Xml.XmlSerializer": "4.2.0",
  "UniversalSerialPort": "1.0.0-*",
  "System.Security.Cryptography.Algorithms": "4.0.0",
  "System.Threading.Thread": "4.3.0"
 },

"frameworks": {
  "netcoreapp1.1":
{
    "imports": "dnxcore50",
    "dependencies":
  {
      "Microsoft.NETCore.App":
    {
        "type": "platform",
        "version": "1.1.0"
      }
    }
 },
"netstandard1.4":
{
      "imports": "dnxcore50"
},

 "net462": {
   "dependencies": {
   }
 }
}
}

编译时我收到多个类似这样的警告:

C:\Program Files (x86)\MSBuild\Microsoft.NetNative\ARM\ilc\IlcInternals.targets(936,5): 警告:ILTransform_0003: Method 'GroupSelect.StartGroupLoop(byte[])' will always throw an由于缺少方法“ThreadStart..ctor(object, IntPtr)”而导致的异常。可能缺少程序集。

所有警告都是关于引用的库。

我已经尝试过这个主题的解决方案,但没有任何帮助: Can't find System.Threading 4.0.10 on Raspberry Pi on Windows 10 IoT

【问题讨论】:

  • 与 OP 没有直接关系。您不是故意考虑 ARMv8 吗?
  • 你为什么要问?我正在使用 Raspberry Pi 2 (ARMv7),因为我有现货。
  • 我问是因为我看到了 x64;所以我假设更大的图景是编译多个拱门。

标签: c# multithreading uwp raspberry-pi2 windows-10-iot-core


【解决方案1】:

我解决了问题。

首先 - 在 UWP 项目引用的每个项目中,最好有 UWP 配置(它的示例):

"uap10.0": {
      "imports": "dnxcore50",
                "runtimes": {
        "win10-arm": {},
        "win10-arm-aot": {},
        "win10-x86": {},
        "win10-x86-aot": {},
        "win10-x64": {},
        "win10-x64-aot": {}
      },
      "dependencies": {"System.Threading.Thread": "4.0.10.0" }
}

第二件事 - 你不能在 UWP 应用程序中使用线程。您必须将线程重写为 asyncawait 并改用 Task

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-14
    • 1970-01-01
    • 2021-02-17
    • 2016-03-09
    • 2018-02-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多