This is a simple, hello world, example.
I have directly linked to: System.Runtime.dll, in the code on line 46, this might need to change for you.
other tags:
.NET Core - Cross-Platform Code Generation with Roslyn and .NET Core.
In-memory C# compilation (and .dll generation) using Roslyn.
dynamically compiles code in .net core 2.