I’ve just created a little app that programmatically compiles code using the C# Compiler, and it works brilliantly. But, one thing that I need it to do is compile Windows.Forms code. Like, I can create a console app with it, but I can’t create a GUI-based form. Here’s the link that got me started:
http://support.microsoft.com/kb/304655
Can somebody please help?
Thank you 🙂
update
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Drawing.Design;
using System.Windows.Forms;
using System.Windows.Forms.Design;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show("hi jason");
}
}
}
The above code is what I type into my application. And when I try to compile this code, my application gives me heaps of errors, and does not produce an exe (obviously). But, my application always successfully compiles straightup console apps…
You need to include both the Form1.cs and Form1.Designer.cs to fully compile it. Of course, you have to include references to the Forms and any other needed namespace as well.