1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Dim CODE As String = Generer_Code 'Code à compiler
Dim CodeProvider As New Microsoft.VisualBasic.VBCodeProvider()
Dim para As CodeDom.Compiler.CompilerParameters = New CodeDom.Compiler.CompilerParameters
Dim ResError As CodeDom.Compiler.CompilerResults = Nothing
para.GenerateExecutable = True
para.MainClass = Projet_Variable.Nom & "." & Nom_Form_Demarrage
para.IncludeDebugInformation = True
para.GenerateInMemory = False
para.TreatWarningsAsErrors = False
For Each a As Reflection.Assembly In Projet_Variable.Reference
para.ReferencedAssemblies.Add(a.Location)
Next
para.CompilerOptions = "/target:winexe"
ResError = CodeProvider.CompileAssemblyFromSource(para, CODE)
If ResError.Errors.Count > 0 Then
Dim errors As String = "Compilation échoué: nombre d'erreurs: " & ResError.Errors.Count & Environment.NewLine
For Each err As CodeDom.Compiler.CompilerError In ResError.Errors
errors += err.ToString & Environment.NewLine
Next
MsgBox(errors)
End If |
Partager