Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while compiling C# winForms [closed]

I am trying to build my first Winforms using C# in Visual Studio 2010. It's just a simple form with a button click event that closes the form. Here's the code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnEnglish_Click(object sender, EventArgs e)
        {
            this.Text = " Do you speak English? ";

        }

        private void btnSpanish_Click(object sender, EventArgs e)
        {
            this.Text = " Do you speak Spanish? ";
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}

This seems as if some configuration properties or something like that is missing in my project by I am unable to find out what exactly?

Some search led me to http://msdn.microsoft.com/en-us/library/fa13yay7.aspx but I am not sure how to apply this in my code or project properties or if there is some other issue?

like image 461
Why Avatar asked Jul 25 '26 18:07

Why


1 Answers

Maybe this answer on MS Connect has somethig to do with your issue. The MS team comment:

This is a known issue that we will not be able to fix for VS2010. The workaround, once in this situation, is to edit the project file and manually re-add the reference

So, in your .csproj file, add the missing reference:

<ItemGroup>
    <Reference Include="mscorlib" />
like image 77
Alex Filipovici Avatar answered Jul 28 '26 06:07

Alex Filipovici



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!