title: Compiling VB Code With CodeDom
body: <p>Read up on it, couldn't find anything that worked for me.
  Basically, I have a file called SourceCode.vb in my resources.
  I'm trying to use: </p>
  
  <pre><code>Dim objCodeCompiler As System.CodeDom.Compiler.ICodeCompiler = New VBCodeProvider().CreateCompiler
  Dim objCompilerParameters As New System.CodeDom.Compiler.CompilerParameters()
  objCompilerParameters.ReferencedAssemblies.Add("System.dll")
  objCompilerParameters.ReferencedAssemblies.Add("System.Windows.Forms.dll")
  objCompilerParameters.ReferencedAssemblies.Add("Microsoft.VisualBasic.dll")
  objCompilerParameters.ReferencedAssemblies.Add("System.Drawing.dll")
  objCompilerParameters.ReferencedAssemblies.Add("System.Data.dll")
  objCompilerParameters.ReferencedAssemblies.Add("System.Deployment.dll")
  objCompilerParameters.ReferencedAssemblies.Add("System.Xml.dll")
  objCompilerParameters.GenerateExecutable = True
  objCompilerParameters.GenerateInMemory = False
  objCompilerParameters.CompilerOptions = "/target:winexe"
  objCompilerParameters.OutputAssembly = "C:\"
  Dim strCode As String = My.Resources.SourceCode.ToString
  Dim objCompileResults As System.CodeDom.Compiler.CompilerResults = objCodeCompiler.CompileAssemblyFromSource(objCompilerParameters, strCode)
  If objCompileResults.Errors.HasErrors Then
      MsgBox("Error: Line&gt;" &amp; objCompileResults.Errors(0).Line.ToString &amp; ", " &amp; objCompileResults.Errors(0).ErrorText)
      Exit Sub
  End If
  </code></pre>
  
  <p>I need it to compile the code and make the file and place it in C:\ - For some reason its not working. Error is:</p>
  
  <blockquote>
    <p>error: line>0, no input sources specified</p>
  </blockquote>
  
  <p>Any ideas? Thanks in advance.</p>
  
  <p>Edit: Problem was that I needed to add an actual name for the file after the output. Thanks for the help Hans.</p>