So I am trying to read and display information from a USB port in VisualStudio C# Windows Forms Application and I would like to use Serial Port commands. However, I am not able to get my system to recognize "using System.IO.Ports"... I have tried searching the internet but I cant figure out how to get the program to import and use the package.
Asked
Active
Viewed 4,457 times
0
-
2Does this answer your question? [Create a C# Core.NET project using System.IO.Ports](https://stackoverflow.com/questions/48545031/) and [Accessing the SerialPort class using .Net Core 3.0](https://stackoverflow.com/questions/58258554/) and [Using System.IO.Ports.SerialPort in .NET Core 1.1](https://stackoverflow.com/questions/42711396/) and [How to add a .dll reference to a project in Visual Studio](https://stackoverflow.com/questions/12992286/) and [Getting local Nuget Package into Visual Studio Solution](https://stackoverflow.com/questions/63828503/) – Aug 06 '21 at 16:03
-
Are you using .NET Framework or .NET? See https://dotnet.microsoft.com/learn/dotnet/what-is-dotnet-framework for more info. If using .NET, you need to install the NuGet package. – Tu deschizi eu inchid Aug 06 '21 at 19:36
1 Answers
0
As others said, If your winform app is a .net frameowrk app, you could try to use the following code directly to use the SeriPort class.
using System.IO.Ports;
SerialPort port = new SerialPort();
If your winform app is a .net core app, you need to install the nuget-package System.IO.Ports
and use the same code to use the class.

Jack J Jun
- 5,633
- 1
- 9
- 27