I've got a small app, which can compile .cs Scripts using CSharpCodeProvider It worked fine for years. Now I've tried a new script and I run into compilation issues. I tracked it down to the usage of a Func delegate with 5 parameters. I know, that there was a switch with .NET Framework 4.0, allowing more than 4 parameters.
Yes, I tried to force the usage of a required compiler version:
var compiler = new CSharpCodeProvider(new Dictionary<string, string> { { "CompilerVersion", "v4.0" } });
But it doesn't help. Whenever I add Func parameter #5, the script does not compile, which leads me to the conclusion, it's somehow using the old compiler.
Any ideas, how to fix this?
I've searched Stackoverflow for similar problems but haven't found any useful answer. The usage of Roslyn is not an alternative, since it includes a lot of dependencies, which I would like to avoid in this small script app.