I threw together a little application in Unity which needs to access a serial port. Since Unity does not include System.IO.Ports I installed the NugetPackage with NugetForUnity. Everything works fine in the engine but if I build the project it somehow can't use System.IO.Ports anymore.
NotSupportedException: System.IO.Ports.SerialPort::.ctorat System.IO.Ports.SerialPort..ctor (System.String portName, System.Int32 baudRate, System.IO.Ports.Parity parity, System.Int32 dataBits, System.IO.Ports.StopBits stopBits) [0x00000] in <00000000000000000000000000000000>:0 at GetInput.Start () [0x00000] in <00000000000000000000000000000000>:0