I need to work with serial ports, I had no problem in .net framework, but now porting on .NET 5 or above (wpf project), My.Computer.Ports.SerialPortNames is no more accessible. Here a simple sub that not work anymore.
Sub GetSerialPortNames()
' Show all available COM ports.
For Each sp As String In My.Computer.Ports.SerialPortNames
ListBox1.Items.Add(sp)
Next
End Sub
I added of course the import and the nuget package System.IO.Ports, but still get the exception BC30456'Computer' is not a member of 'myapp.My'. Any advice?