title: The name InitializeComponent does not exist in the current context
body: <p>I wanted to learn about building files with c# so I created a Windows Forms Application and I created this code/form. But It did not seem to work.<br>
  . </p>
  
  <p><a href="https://i.stack.imgur.com/mgeOP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mgeOP.png" alt="enter image description here"></a></p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  using System.CodeDom.Compiler;
  using Microsoft.CSharp;
  
  namespace teztie
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
  
          }
  
          private void button1_Click(object sender, EventArgs e)
          {
              SaveFileDialog sfd = new SaveFileDialog();
              sfd.Filter = "*.exe |*.exe";
              DialogResult result = sfd.ShowDialog();
              if (result == DialogResult.OK)
              {
                  build(sfd.FileName, textBox1.Text, textBox2.Text);
              }
          }
  
          private void build(string output, string msg, string name)
          {
              CompilerParameters p = new CompilerParameters();
              p.GenerateExecutable = true;
              p.ReferencedAssemblies.AddRange(new string[] { "System.dll", "System.Windows.Forms.dll"});
              p.OutputAssembly = output;
              p.CompilerOptions = "/t:winexe";
  
              string source = Properties.Resources.source;
              string errors = string.Empty;
  
              source = source.Replace("[MSG]", msg);
              source = source.Replace("[NAME]", name);
  
              CompilerResults results = new CSharpCodeProvider().CompileAssemblyFromSource(p, source);
  
              if (results.Errors.Count &gt; 0)
              {
                  foreach (CompilerError err in results.Errors)
                  {
                      errors += "Error: " + err.ToString() + "\r\n\r\n";
                  }
              }
              else
              {
                  errors = "Successfully built:\n" + output;
              }
  
              MessageBox.Show(errors, "Build", MessageBoxButtons.OK, MessageBoxIcon.Information);
          }
      }
  }
  </code></pre>
  
  <p>Source.Txt:</p>
  
  <pre><code>using System;
  using System.Windows.Forms;
  
  namespace code
  {
      public partial class Form1 : Form
      {
          public Form1()
          {
              InitializeComponent();
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
              MessageBox.Show("[msg]",  "[title]" );
          }
      }
  }
  </code></pre>
  
  <p>But when I click the compile button it gives me an error.
  The name InitializeComponent does not exist in the current context.</p>
  
  <p><a href="https://i.stack.imgur.com/Dl3CR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Dl3CR.png" alt="enter image description here"></a></p>