Ubuntu 12.04でmcsバージョン2.10.8.1を使用していますが、次のコードがあります。
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.ShowDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
string fileName;
fileName = dlg.FileName;
MessageBox.Show(fileName);
}
}
}
}
コマンドを使用してコンパイルします
$ mcs source_code.cs -r:System.Windows.Forms.dll -r:System.Drawing.dll
そして、私はエラーを受け取ります
source_code.cs(11,13): error CS0103: The name `InitializeComponent' does not exist in the current context
Compilation failed: 1 error(s), 0 warnings
Visual Basicを使用している場合、この質問に対する多くの回答を見てきました。この問題を解決するために何をすべきか知りたいのですが。ありがとう。