Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Need CodeDom builder tutorial.

(Aug 17, 2014 08:45 AM)Voidlight Wrote:  I have searched a lot on google, and using the hackforums search function, like i know you will all tell me to do, but i have just come up with a lot of errors or just dont understand it.

Could someone walk me through a codedom compiling example with string replacement within the stub located in the resources? Or, link me to a working and usable example that i could learn from? thanks.

Qeustion is, at what level are ya, plain said, what do you know.
I'll give you mine, editing this shortly.

Code
Private Sub CompileApp(ByVal filename As String)
      Dim provider As CodeDomProvider = CodeDomProvider.CreateProvider("VisualBasic")

      Dim parameters As New System.CodeDom.Compiler.CompilerParameters()
      ' Add reference
      parameters.ReferencedAssemblies.Add("System.dll")
      parameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
      parameters.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
      parameters.ReferencedAssemblies.Add("System.Drawing.dll")

      'Compile in memory
      parameters.GenerateExecutable = True
      parameters.OutputAssembly = filename
      parameters.CompilerOptions = "/target:winexe"

      Dim strCode As String = "Your Code here"
      Dim CompileResults As New System.CodeDom.Compiler.CompilerResults(Nothing)

      CompileResults = provider.CompileAssemblyFromSource(parameters, strCode)

      If CompileResults.Errors.HasErrors Then
      ' If an error occurs
      MessageBox.Show("Error: Line>" & CompileResults.Errors(0).Line.ToString & ", " & _
      CompileResults.Errors(0).ErrorText)
      End If

    End Sub

Found this, hope it helps. It's from a working example i got here laying...
i think its well explained
https://hackforums.net/showthread.php?tid=3757923
https://hackforums.net/showthread.php?tid=3579582
http://msdn.microsoft.com/en-us//library....110).aspx

Regards,


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by stdioMar 4, 2016 12:22 PM 34 4,787 Mar 4, 2016 12:22 PM
Last Post: Russ.
[.NET] by Slavoj ŽižekJun 17, 2015 01:00 AM 13 1,217 Jun 17, 2015 01:00 AM
Last Post: ShittyAdvice
[.NET] by MR FRODONov 22, 2014 08:51 AM 34 4,356 Nov 22, 2014 08:51 AM
Last Post: MickyCOB