Why does Unity3D build throw a reference rewriter exception when encountering System.Net.WebSockets.WebSocket in .NET Standard 2.0?

I tried to build an UWP edition of my Unity3D app. I set API compatibility to .NET Standard 2.0, .NET level to .NET 4.6 experimental, and imported my custom plugins (.NET standard 2.0 assemblies built in Visual Studio 2017 Enterprise) into my Assets folder.

I pressed build and saw this in the build log:

Reference rewriter: Error: type System.Net.WebSockets.WebSocket doesn’t exist in target framework. It is referenced from

I didn’t have to reference any assembly to get the System.Net.WebSockets in my .NET Standard 2.0 project in Visual Studio.

Why am I getting this error then?

I tried changing API compatibility level to .NET 4.x but still got the error:

artScreen.DualSimTileContract.winmd;,Windows.UI.WebUI.Core.WebUICommandBarContract.winmd" “–ignore=System.IConvertible,mscorlib”.
Error: type System.Net.WebSockets.ClientWebSocket doesn’t exist in target framework.