I installed https://www.nuget.org/packages/SerialPortStreamCore/ and it seems to work fine on windows but but publish program gives error when ran on linux.
Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'libnserial.so.1': The specified module could not be found.
(Exception from HRESULT: 0x8007007E)
at RJCP.IO.Ports.Native.Unix.SerialUnix.UnsafeNativeMethods.serial_init()
.
.
at RJCP.IO.Ports.SerialPortStream..ctor()
Hi @0807Jpatel this nuget is not part of dotnet/corefx. Its owner is @jaime-olivares. Currently dotnet/corefx generates a nuget, still in preview, for System.IO.Ports but for now only for windows.
@0807Jpatel I am going to close the issue but feel free to continue the conversation here if you still have any questions.
@pjanotti Hey so is there a way for me to communicate with ports on linux for .net core? preview or stable.
Thank You
Looks like people have been successful using the library you referenced. You could try opening an issue on the github site for that library https://github.com/jcurl/SerialPortStream if you have questions about it.
It looks like that package doesn't come with the native binary. You are going to need it in order to get it to work. See the instructions on that projects readme for Linux and how to compile the support library.
https://github.com/jcurl/SerialPortStream/blob/v2.x/README.md
@Petermarcu I was able to use SerialPortStream and get it working on .dotnet preview for linux.
steps to follow: clone SerialPortStream, cd into dll/serialunix and Run following commands
# cmake . && make && make install
This might give you
Makefile:116: recipe for target 'install' failed
make: *** [install] Error 1
Ignore it.
Now Copy the generated libnserial.so.1.1 to project folder and rename it to libnserial.so.1 this should do the trick. If you the ports don't show up, run program as root.
@pjanotti @Petermarcu Thank You
Awesome. Great to hear it worked! I may use this for a personal project as well. Hope it works on ARM :)
@Petermarcu I was able to get it running on Ubuntu Mate arm for Raspberry Pi 3, so you should be able to.
Sweet!
Hi,
I am writing a program to communicate with serial ports on both Windows and Linux using System.IO.Ports.
So far working fine on Windows but shows "System.IO.Ports is currently only supported on Windows." on Linux. So, what is the ETA of "System.IO.Ports" for Linux support? Is there a preview version I can test out?
Thanks!
@danmosemsft was this on any of the lists for the compatibility pack?
The Windows version is in the compatibility pack. There isn't work scheduled right now to port it to Linux. We'd certainly be happy to see it ported to Linux. If folks would like to look at that, @pjanotti is the person to work with.
I would love to see System.IO.Ports work on Linux. It will be very useful
pretty good, i also let it run on raspberry pi under dotnet2.0
+1 for SerialPort support on Linux, really could benefit a lot embedded engineers.
@omerk perhaps you can try or help with https://github.com/dotnet/corefx/pull/29033
@wfurt
+1 for this and thanks @0807Jpatel for your setup notes, will try this later as need Serial port support for the Raspberry Pi.
Most helpful comment
I would love to see
System.IO.Portswork on Linux. It will be very useful