Trying to compile this sample of code:
var c = new CSharpCodeProvider();
var cp = new CompilerParameters();
var className = $\"CodeEvaler_{Guid.NewGuid().ToStrin
I had the same problem with .NetCore 2, but with a bigger CodeDOM project. My solution I am right now building is generating the source from CodeDom and then passing it to Roslyn. (As Roslyn was mentioned in a comment, but only a .NET Framwork solution was posted)
Here is a good example how to use Roslyn - just add the
Microsoft.CodeAnalysis.CSharp NuGet package and System.Runtime.Loader NuGet package
and then use the code here (Or just follow the example): https://github.com/joelmartinez/dotnet-core-roslyn-sample/blob/master/Program.cs