Change the System.IO.Ports nugget package to 8.0.0, as it is suggested by this similar issue in Microsoft forum: https://learn.microsoft.com/en-us/answers/questions/1621393/system-io-ports-only-availble-on-windows-but-im-us#:~:text=I%20changed%20the%20system.io.ports%20package%20to%20version%208.0.0