Mukund

I am working with codedom in .NET 2.0. But I am getting following warning during compilation. Can somebody tell me how to get rid of this

Compiler Warning

'System.CodeDom.Compiler.CodeDomProvider.CreateGenerator()' is obsolete: 'Callers should not use the ICodeGenerator interface and should instead use the methods directly on the CodeDomProvider class. Those inheriting from CodeDomProvider must still implement this interface, and should exclude this warning or also obsolete this method.'



Re: .NET Base Class Library CodeDOM: Warning at compilation

nielsvanvliet

If you want a C# provider, do not use CreateGenerator, but create a CodeDomProvider:
CodeDomProvider p = new Microsoft.CSharp.CSharpCodeProvider();
And then use it. For example p.CompileAssemblyFromDom(...) or p.GenerateCodeFromCompileUnit(...).

For the VB it is the same.