Windows 10 个 IoT ARM (Raspberry Pi) System.Threading - 缺少引用
Windows 10 IoT ARM (Raspberry Pi) System.Threading - missing references
我正在尝试为 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): warning : ILTransform_0003: Method 'GroupSelect.StartGroupLoop(byte[])' will always throw an exception due to the missing method 'ThreadStart..ctor(object, IntPtr)'. There may have been a missing assembly.
所有警告都是关于引用库的。
我试过这个主题的解决方案,但没有任何帮助:
Can't find System.Threading 4.0.10 on Raspberry Pi on Windows 10 IoT
我解决了问题。
首先 - 在 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 应用程序中使用线程。您必须将线程重写为 async、await 并改用 Task。
我正在尝试为 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): warning : ILTransform_0003: Method 'GroupSelect.StartGroupLoop(byte[])' will always throw an exception due to the missing method 'ThreadStart..ctor(object, IntPtr)'. There may have been a missing assembly.
所有警告都是关于引用库的。
我试过这个主题的解决方案,但没有任何帮助: Can't find System.Threading 4.0.10 on Raspberry Pi on Windows 10 IoT
我解决了问题。
首先 - 在 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 应用程序中使用线程。您必须将线程重写为 async、await 并改用 Task。