Installing Visual C# Express
An updated version of this tutorial can be found here.
The Crash Course
- To program in C#, we will need a program that allows us to write C# code and run it. That program is Microsoft Visual C# Express 2010. It can be downloaded and installed like you'd expect.
- A "pro" version exists, which is quite expensive, but also very nice: Microsoft Visual Studio.
Welcome to the world of C# programming! Your first step, before writing a single line of code, will be to download and install the latest version of Microsoft Visual C# Express, which is the 2010 version.
This version is completely free! In fact, everything I'm going to tell you how to use, throughout all of these tutorials, will be completely free.
There is a version of the program that we are going to install that is not free, and it has more features, but for all of the basics (and in fact, for a whole lot more than just the basics) the free version is going to be more than enough. Just so you are fully informed, though, the full version is called Visual Studio 2010, and is, for the record, a very nice program. I, however, do most of my coding in the free Express version, and you can too.
So let's get going, and install us a nice free version of Visual C# Express.
A Note about the 2012 Versions of Visual Studio
The new 2012 versions of the Visual Studio family were released in the summer of 2012, but I'm having a hard time recommending them to people right away. Especially on this site. Like when the 2010 versions were released, there's not immediate support for XNA yet. I'm sure it is coming in time, but for now, if you're going through these tutorials because you want to make XNA games, you'll want to stick with Visual Studio 2010 or Visual C# Express 2010 for the time being.
If you're not planning on making XNA games, you can begin to consider the 2012 versions. If you're willing to pay, the full Visual Studio 2012 version is what you want. But it isn't exactly cheap.
Instead, you can take a look at the various flavors of Visual Studio Express 2012. They advertise four different flavors of this: one for Windows 8 "metro" style apps, one for web, one for desktop, and one for Windows 7/8 phone development. But each of these have small problems that… well… make me recommend to you that you start with Visual C# Express 2010 anyway, at least until you get off the ground. Through these tutorials, at least.
To start, Visual Studio Express 2012 for Windows 8 is designed for making "metro" style apps. (The apparently don't want to call it that, but it's what everyone calls it.) Metro-style apps DO NOT WORK on Windows XP, Vista, or 7, and there's a lot of things they can't do. They're somewhat limited. This version exists because Microsoft is really trying to push the Metro stuff, in an effort to get better apps for their tablet and phone systems. So if you want to use this, you need to install Windows 8 (which hasn't been fully released yet, and note that at least when I installed it, it wiped out all of my existing programs, but not files) and what you do won't work on other platforms. Furthermore, the starting point for a Metro-style app is a higher level than the console apps that we'll start with in these tutorials. At a minimum, start with Visual C# Express 2010, and after you've gotten the hang of things, switch over.
Visual Studio Express 2012 for Web is designed for making web applications. It has some, but not all of the same limitations that the "for Windows 8" one had. It runs on Windows 7 and Vista, but the starting points for web development, like Metro-style apps, is a bit more complicated. Again, start with Visual C# Express 2010 and switch over once you've gotten through the basics.
Visual Studio Express 2012 for Desktop would be my recommended starting point if you don't want to make XNA games, just general C# applications. In theory. But it doesn't exist yet. In fact, at first, they weren't even going to have a desktop version, and the backlash they got from the developers was strong enough that they promised to release a desktop version "in the fall". When this version is out, it's what I'll recommend for getting started.
Visual Studio Express 2012 for Windows Phone also doesn't exist yet. They've sync'd the release of Visual Studio Express 2012 for Windows Phone with the release of the new Windows Phone. If phone development is what you want, they're still saying to use the Visual Studio Express 2010 for Windows Phone until then.
TL;DR: If you have the money, and you're not making games, go with Visual Studio 2012. If you have the money, and you're making games, consider Visual Studio 2010 (but check into upgrading costs for later, first). Otherwise, start with Visual C# Express 2010, and then depending on what you want to do, move up into one of the 2012 versions if you want.
Installing Visual C# Express 2010
The program we want to install can be found here: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express.
Follow the link, and click on the download button.
You will then follow the normal installation steps that every program has, until the software is installed.
Installation typically takes several minutes, maybe upwards of 20 minutes or so, if you have a slower Internet connection. The installation for Visual C# Express may also involve installation of other packages too, like the .NET framework, and so on, which Visual C# Express will need in order to work, so if it asks you for permission to install other components, don't be surprised.
The Registration Key Thing…
When you get Visual C# Express installed, you'll see it ask you to put in a registration key, at some point along the way. You can use the program without a registration key for 30 days, but then it forces you to get one.
Like basically everything that I talk about in all of these tutorials, Visual C# Express is free. It costs absolutely no money to get a registration key, but Microsoft is trying to keep track of all of the people who are using their software. So when it is convenient, follow their links to their site to get a registration key, and you should be good. For the record, I think I occasionally get an email from them, but it's not too often. At least, it didn't seem so for me.
Running Visual C# Express 2010
Once the program is installed, you will be able to run it, like any other program. It may add an icon to your desktop, or not, but it will also show up in your Start Menu, (probably under "Microsoft Visual Studio 2010 Express").
Now that we've got a program installed that allows us to write C# code, we're all ready to go, and get started with our first program!