In older versions of Unity (e.g. v5), I used to solve this issue by setting 

> 
> Edit > Project Settings > Player > **PC setting** (icon) > Other Settings > **API Compatibility Level**
> 
> 
> 

from **.Net 2.0 Subset** to **.Net 2.0**

but in Unity 2018.3.2f1, this doesn't solve the issue. I also set the same setting to **.Net 4.x** but it didn't help.

**Note 1**: My build settings is set to **Android** platform but I need SerialPort class from System.IO.Ports namespace in order to read the serial port while running the game in the Unity Editor (PC). I have done this before with Unity 5.

**Note 2**: I cannot manually add a reference to the related assembly in the Visual Studio project made by Unity. The command is removed.