Setting up a C# project within Unity's generated solution to be used as an assembly

I’m trying to set up a new C# project (Class Library Portable), but after referencing the other project I still get errors whenever I try to use attributes or similiar objects replaced by Mono.

The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Adding a reference to mscorlib.dll inside Unity 2017.2.0b2\Editor\Data\MonoBleedingEdge\lib\mono\4.6.2-api\ ends up killing the project completely, as now there are missing references to pretty much everything.

Is there any way how to properly set up a project for the new AssemblyBuilder?

Don’t use Portable Class Library project type, it’s not meant to be used with Unity.

Use just regular Class Library project type.