Hydrotronics

CS Compiler for VB

May 2nd, 2018
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Imports Microsoft.CSharp
  2. Imports System.CodeDom.Compiler
  3. Imports System.Drawing
  4. Imports System.Diagnostics
  5.  
  6. Namespace C
  7. Module Module1
  8. Dim parameters As New CompilerParameters()
  9.  
  10. Sub Main()
  11. Dim Provider = CodeDomProvider.CreateProvider("CSharp")
  12.  
  13. parameters.GenerateExecutable = True
  14. parameters.OutputAssembly = "Output.exe"
  15. Dim results As CompilerResults = Provider.CompileAssemblyFromSource(parameters, "N:/C#/Code.txt")
  16.  
  17. If results.Errors.Count > 0 Then
  18. For Each Err As CompilerError In results.Errors
  19. MsgBox("Line number " & Err.Line & ", Error Number: " & Err.ErrorNumber & ", '" & Err.ErrorText + ";")
  20. Next
  21. Else
  22. MsgBox("Successful compile")
  23. Process.Start("Output.exe")
  24. End If
  25. End Sub
  26.  
  27. End Module
  28. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment