Hi there, i was trying to accomplish to that task with codedom classes, but i can't compile my code!
May you post here an example which does succesfully that?
I already searched through this forum and the web but i still can't even make a step towards the solution.
Thanks in advance!
Here are son additional information i forgot to write before,
my current code is this:
and the source file Form1.vb contains:
I guess the code in the source file is incorrect...
What should i write there?
May you post here an example which does succesfully that?
I already searched through this forum and the web but i still can't even make a step towards the solution.
Thanks in advance!
Here are son additional information i forgot to write before,
my current code is this:
VB.NET:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim CodeDomProvider As CodeDomProvider = CodeDomProvider.CreateProvider("VB")
Dim fl As String = "Form1.vb"
CompileCode(CodeDomProvider, fl, "C:\Documents and Settings\Slascio\Desktop\ciabbb.exe")
End Sub
Public Shared Function CompileCode(ByVal provider As CodeDomProvider, _
ByVal sourceFile As String, _
ByVal exeFile As String) As CompilerResults
' Configure a CompilerParameters that links System.dll
' and produces the specified executable file.
Dim referenceAssemblies As String() = {"System.dll"}
Dim cp As New CompilerParameters(referenceAssemblies, exeFile, False)
' Generate an executable rather than a DLL file.
cp.GenerateExecutable = True
' Invoke compilation.
Dim cr As CompilerResults = provider.CompileAssemblyFromFile(cp, _
sourceFile)
' Return the results of compilation.
Return cr
End Function
End Class
and the source file Form1.vb contains:
VB.NET:
imports System
Namespace MyNamespace
Public Class Classe1
Private Sub main()
MsgBox("nap")
End Sub
End Class
End Namespace
I guess the code in the source file is incorrect...
What should i write there?
Last edited: