This is a simple example of using Roslyn to compile some code from a string,
load it into the currently executing AppDomain
, and activate and invoke the code.
It is based on this article
and was adapted for the slightly different API surface area on .net core.
This was written to work with .NET Core 2.2.
This example uses bash, but you can run this from any dotnet core supported platform
git clone https://github.com/joelmartinez/dotnet-core-roslyn-sample.git
cd dotnet-core-roslyn-sample
dotnet restore && dotnet run