Hey guys!

Hope you all doing well :)

I have the following error in my assemblies:

'System.CodeDom.Compiler.CodeDomProvider.CreateCompiler()' is obsolete: '"Callers should not use the ICodeCompiler 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."'

and my code is the following:

static ICodeCompiler CreateCompiler()
{

using (CodeDomProvider codeProvider = new CSharpCodeProvider())
{
ICodeCompiler compiler = codeProvider.CreateCompiler();
return compiler;
}
}

What would be the correct way then to write the code and NOT get the warning. And if anyone could also just explain a bit as to why the CreateCompiler() is obsolote - just for some background and knowledge

Fanx guys

Go well and happy coding :)

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.