使用 system.io.ports c# Windows 物联网通用

Using system.io.ports c# Windows IoT Univeral

我正在开发 Windows IoT 通用应用程序,我需要访问串行端口。通常我会使用:

using System.IO.Ports;

但是该代码生成了一个错误,指出命名空间不存在,我找不到要添加的引用来修复它。

在 Windows IoT 上,您必须使用 Windows.Devices.SerialCommunication namespace to access serial ports. You have to have Windows 10 IoT Extension SDK(安装程序应与 Windows 10 图像文件捆绑在一起供您使用,您必须在那里注册才能下载) 安装并添加为参考,以便能够访问该命名空间。

请记住,如果您使用 Raspberry Pi 板载 UART 无论如何都将无法访问,因为它用于内核调试器。