c# - CompilerParameters.ReferencedAssemblies -- Add reference to System.Web.UI.WebControls -
I am compiling classes in run-time using the CodeDomProvider class. It works fine for classes using only the system namespace:
using the system; Public class test {public string helloard () {return "hello world!"; }} If I try to compile a class using System.Web.UI.WebControls , then I get this error: />
{error CS0006: Metadata file 'System.Web.UI.WebControls' could not be found} System.CodeDom.Compiler.CompilerError
of my code One snippet is:
var cp = new compiler parameter (); Cp.ReferencedAssemblies.Add ("System.Web.UI.WebControls"); How do I reference the System.Web.UI.WebControls namespace?
You should use MSDN to view the name of the assembly that you use in reference assemblies, namespaces To include the necessary sections: In this case, this is happening:
var cp = new compilerParameters (); Cp.ReferencedAssemblies.Add ("System.Web.dll");
Comments
Post a Comment