I am compiling classes at run-time using the CodeDomProvider
class. This works fine for classes only using the System
namespace:
using System;
public class Test
{
public String HelloWorld()
{
return "Hello World!";
}
}
If I try to compile a class using System.Web.UI.WebControls
though, I get this error:
{error CS0006: Metadata file 'System.Web.UI.WebControls' could not be found} System.CodeDom.Compiler.CompilerError
Here's a snippet of my code:
var cp = new CompilerParameters();
cp.ReferencedAssemblies.Add("System.Web.UI.WebControls");
How do I reference the System.Web.UI.WebControls
namespace?