Type or Namespace 'Ports' does not exist in System.IO

My Unity3D Version: 2017.3.0f3 Personal

  1. I am communicating with my programm with a serial port. It works well in the Player Editor, using Unity. But when I want to compile it to deploy it to my HoloLens, it doesn’t.

  2. I get the error message: The type or namespace name ‘Ports’ does not exist in the namespace ‘System.IO’ (are you missing an assembly reference?)

  3. I’ve tried so far:

Changed Configuration to .NET 2.0

Reimported the whole project

Downloaded and Added system.dll manually to the assets

I’ve searched almost the whole i-net, but nothing worked for me. I even looked on japanese/chinese website using google translator they always say the same (-> .NET 2.0)

I would be very grateful for your help!

Edit1: I tried also #if NETFX_CORE -mycode- #endif

My guess is that it’s not being added to the build. Try this: Unity - Manual: Managed plug-ins

Go to Edit->projectsettings->Player->APIcompetibilityLevel = .Net4.x
This worked for me.