P
pamelafluente
Hi I am adjusting a project for VS2005. I had this code which worked
fine in VS2003 and now I am having a warning:
Warning 1
'Public Overrides Function CreateCompiler() As
System.CodeDom.Compiler.ICodeCompiler' is obsolete: 'Callers should not
use the ICodeCompiler interface and should instead use the methods
directly on the CodeDomProvider class.
Could you, please, suggest the code changes to adapt this code to
VS2005 (any language will be fine). If appropriate, return result in a
CompilerResults object, as in my code, or equivalent, please.
My VB2003 "OBSOLETE" code:
------------------------------------------------------
Public MyObjectCode As String
Public ICodeCompiler As ICodeCompiler
Public CompilerParameters As CompilerParameters
Public CompilerResults As CompilerResults
Dim VBCodeProvider As New VBCodeProvider
Me.ICodeCompiler = VBCodeProvider.CreateCompiler()
Me.CompilerParameters = New CompilerParameters
With CompilerParameters
.IncludeDebugInformation = False
.GenerateInMemory = True
.GenerateExecutable = False
'... more parameters here
End With
Me.CompilerResults =
Me.ICodeCompiler.CompileAssemblyFromSource(Me.CompilerParameters,
Me.MyObjectCode)
'-------------------------------------------------------------------------------------
Thank you very much in advance!
-Pamela
PS.
As side question, does this warning mean that there is no more need to
instantiate a compiler, because we can use one which is already
instantiated internally?
fine in VS2003 and now I am having a warning:
Warning 1
'Public Overrides Function CreateCompiler() As
System.CodeDom.Compiler.ICodeCompiler' is obsolete: 'Callers should not
use the ICodeCompiler interface and should instead use the methods
directly on the CodeDomProvider class.
Could you, please, suggest the code changes to adapt this code to
VS2005 (any language will be fine). If appropriate, return result in a
CompilerResults object, as in my code, or equivalent, please.
My VB2003 "OBSOLETE" code:
------------------------------------------------------
Public MyObjectCode As String
Public ICodeCompiler As ICodeCompiler
Public CompilerParameters As CompilerParameters
Public CompilerResults As CompilerResults
Dim VBCodeProvider As New VBCodeProvider
Me.ICodeCompiler = VBCodeProvider.CreateCompiler()
Me.CompilerParameters = New CompilerParameters
With CompilerParameters
.IncludeDebugInformation = False
.GenerateInMemory = True
.GenerateExecutable = False
'... more parameters here
End With
Me.CompilerResults =
Me.ICodeCompiler.CompileAssemblyFromSource(Me.CompilerParameters,
Me.MyObjectCode)
'-------------------------------------------------------------------------------------
Thank you very much in advance!
-Pamela
PS.
As side question, does this warning mean that there is no more need to
instantiate a compiler, because we can use one which is already
instantiated internally?