sujeshva
asked on
CodeDomProvider to Target .Net 1.1
I have a project that is being written in VB.Net 3.5. The idea of this project (part of it) is to generate a compiled assembly at runtime. The user of the generated assembly is a service which is written in .Net 1.1 framework and at this time is not scheduled for a conversion.
I have the following code as shown below. This works fine and does generate the assembly, but in .Net 3.5 target framework. How can I target 1.1??
I have tried
Dim provOpt = New Dictionary(Of String, String)
provOpt.Add("CompilerVersi on", "v1.1.4322")
This does not work and throws out an error as "Compiler executable file vbc.exe cannot be found".
I have tried v1.1, just 1.1 and other possible combinations!
I absolutely need a solution to this and the target framework has to be 1.1 and the code needs to be written in 3.5 as the entire project is going to make use of it.
Please help.
Thanks,
Suj
I have the following code as shown below. This works fine and does generate the assembly, but in .Net 3.5 target framework. How can I target 1.1??
I have tried
Dim provOpt = New Dictionary(Of String, String)
provOpt.Add("CompilerVersi
This does not work and throws out an error as "Compiler executable file vbc.exe cannot be found".
I have tried v1.1, just 1.1 and other possible combinations!
I absolutely need a solution to this and the target framework has to be 1.1 and the code needs to be written in 3.5 as the entire project is going to make use of it.
Please help.
Thanks,
Suj
Dim Compiler As VBCodeProvider = Nothing
Dim pvdr As CodeDomProvider
Dim CompilerParams As CompilerParameters
Dim CompileResults As CompilerResults
Public Function CompileCode() As String
Dim strReturn As String = ""
Try
CompilerParams = New CompilerParameters
With CompilerParams
.TreatWarningsAsErrors = False
.WarningLevel = 4
.GenerateInMemory = False
.IncludeDebugInformation = True
Dim References() As String = {"System.dll", "System.Data.dll", "Microsoft.VisualBasic.dll"}
.ReferencedAssemblies.AddRange(References)
.OutputAssembly = "C:\Projects\ThisIsATestDLL.dll"
End With
Dim provOpt = New Dictionary(Of String, String)
provOpt.Add("CompilerVersion", "v3.5")
Compiler = New VBCodeProvider(provOpt)
CompileResults = Compiler.CompileAssemblyFromFile(CompilerParams, "C:\RandD\VS08\TestClassLib\Test.vb")
If CompileResults.Errors.HasErrors Then
For Each Err As CodeDom.Compiler.CompilerError In CompileResults.Errors
strReturn &= Err.ErrorText & " @Line: " & Err.Line & vbCrLf
Next
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
Return strReturn
End Function
http://forums.asp.net/p/1249279/2304814.aspx
ASKER
rkworlds,
Thats not the answer I am looking for. I am looking to use the CodeDomProvider to compile a dll targeting the 1.1 Framework from a 3.5 Assembly.
Thats not the answer I am looking for. I am looking to use the CodeDomProvider to compile a dll targeting the 1.1 Framework from a 3.5 Assembly.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.