The CompilerResults
type contains the property Errors
. If you look into in, you will find:
error CS0234: The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
This is because types in the System.Linq
namespace (like Enumerable
) are in the System.Core.dll
assembly. If you add that, then your code will start working:
parameters.ReferencedAssemblies.Add("System.Core.dll");