首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在PlatformNotSupportedException 3.1和4.7 System.IO.Ports中获取“System.IO.Ports”

在PlatformNotSupportedException 3.1和4.7 System.IO.Ports中获取“System.IO.Ports”
EN

Stack Overflow用户
提问于 2020-05-18 08:43:26
回答 1查看 1.5K关注 0票数 0

我正在开发使用System.IO.Ports的多平台库。

库是用.NET Core3.1编写的,并且使用了Nuget的System.IO.Ports 4.7,这个版本在linux中应该已经被支持了。但是,当我运行主应用程序时,仍然会导致同样的问题。

代码语言:javascript
复制
System.PlatformNotSupportedException: System.IO.Ports is currently only supported on Windows.
   at System.IO.Ports.SerialPort..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits)

当我在谷歌上搜索这个问题时,我发现System.IO.Ports 4.7和.NET Core3.1的组合应该可以在linux上工作,但是没有任何效果。

我也尝试过不同的库,比如crozone.SerialPorts,但是每个库都有一些问题,不起作用,f.e。invlaid parameter when running /dev/stty等..。有哪些库可以解决这个问题,linux/windows使用串口?

非常感谢

EN

回答 1

Stack Overflow用户

发布于 2020-11-01 09:10:06

您必须安装包含以下内容的System.IO.Ports包(而不仅仅是dll文件):

-Microsoft.win32.Registry ...

-System.Memory

-runtime.native.System.IO.ports ...

-System.ioPorts.dll

如果要使用的软件包版本高于VS nuget中的版本,则可以使用包管理器控制台安装它。

这种方法对我有效。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61865706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档