Skip to content

C# Adventure 01: Setup

An Integrated Development Environment (IDE) like Visual Studio is recommended. Ideally you will have a computer that can run a version of the free application.

You are not required to use an IDE like Visual Studio to code, but it does help make some things easier. Learn how to download and setup the IDE or alternatives if you want to learn C# without it.

Setup

If you are new to C# you probably want to get the latest free version of the Visual Studio Community IDE. It supports building applications for Android, iOS, Windows, the web, and cloud services, and is available for both macOS* and Windows. When you are comfortable with C# you will have a lot of options for future application development.

The screenshots throughout the C# Adventure are of Visual Studio Community 2015 and Visual Studio Enterprise 2017 on Windows 10. If you have a different version of the Visual Studio IDE, or a different operating system, your code should still work fine. The screenshots may look different, though, from what you see on your screen.

You don't have to install software to learn C#, but it does make somethings easier. If installing Visual Studio is not an option for you, expand the section below 'Code Editors, IDEs, and Alternatives'.

* Note: Visual Studio may work differently on macOS. You may not have the same capabilities as on a PC, or the options may need to be accessed in a different way (i.e., not under the same menu).

Code Editors, IDEs, and Alternatives

IDEs are applications that have utilities (such as a code editor, compiler, and a debugger) bundled together. They are designed to help you develop faster and more efficiently. They usually support development in several programming languages and are cross platform.

Writing code in an integrated development environment, you'll usually find syntax coloring and context-sensitive help. Some IDEs also have "Intelligent Code Completion" such as Visual Studio's IntelliSense, and the integrated code completion in Eclipse.

Text editors like SciTE and Atom also have syntax coloring, but not all text editors have the range of helpful options a larger application like an IDE will offer.

Compiling your code into an executable or deploy-able application is often easier and faster with an IDE. Some debuggers highlight errors as you are writing your code. Checking for syntax errors is especially helpful if the IDE points you to the line number where the error is, and offers suggestions on how to fix it. Even if you are writing code that doesn't need to be compiled, an IDE can be helpful with editing and debugging.

If you are new to programming it is highly recommended that you use an IDE like Visual Studio Community to build your adventure game. There are other free alternatives such as MonoDevelop, which is an open source integrated development environment for Linux, OS X, and Windows. MonoDevelop was primarily designed for C# and .NET, but you can also use it with other languages.

Free IDE Options

  • Visual Studio: Microsoft's Visual Studio IDE for Windows and macOS supports several languages including C#, F#, and C++. With this IDE you can build applications for Android, iOS, Windows, the web, and cloud services.
  • Visual Studio Code: Free and open source, Visual Studio Code works on Windows, macOS, and Linux.
  • MonoDevelop: MonoDevelop supports Linux, Windows, and Mac OS X. You can use it to create desktop and web applications using C#, F#, C/C++, and other languages.
  • Eclipse: Primarily for Java, C/C++ and PHP, Eclipse can also be used for C# and other languages with a plug-in (such as Emonic).

Free Text Editors

Alternatively, you can use a text editor to write C# code. The articles Working with the C# 2.0 Command Line Compiler and Command-line Building With csc.exe show how to create a C# application with a text editor and compile it via the command line.

If you are working through this series without an IDE:

  • Instead of typing your code into the IDE, you will type it in a text editor.
  • When the instructions say press the start button or the keyboard F5 button you will need to compile your code on the command line instead.
  • Visual Studio indicates syntax errors and gives hints on how to fix them. Without an IDE you will have to pay close attention to your code and debugging might be trickier.

Atom

The open source option from GitHub, Atom works on OS X, Windows, and Linux. It has autocomplete, is extendable with packages, and has a lot of customization options.

SciTE

SciTE is a free Text Editor built with Scintilla (open source code editing component). You can use SciTE with Intel Win32, OS X, and Linux.

It supports a wide range of languages (over ninety!), and has a lot of extra options available such as using the output pane to run commands and compile code.

Setup Development Environment Options: C# code in SciTE
C# code in SciTE

Running C# Online (No Cost)

You can also run C# code online. This is helpful to see the output of your programming, especially if you are simply experimenting.

There are many online options, here are a few:

To Do

Assignments

  1. Download Visual Studio and install it. (Recommended: Watch Professor Mike Hadley's video that walks through installing Visual Studio 2019)
  2. When you install make sure you check any implementation options that you think you might use. For example, if you want to develop Universal Windows Platform (UWP) applications (mobile, tablet, and PC) in the future, be sure the UWP options are checked when you are preparing to install. Microsoft has example screenshots and a walk through of how to install the IDE on their website: Install Visual Studio.

Development Environment

The first time you start Visual Studio it might ask you what default development environment you'd like. We'll be using Visual C#. If you would like to change the default in the future, instructions are on the MSDN site.

Visual Studio Themes

You can change your Visual Studio default theme. Select the Tools menu on the menu bar, then Options. In the options list, choose Environment, General. There you should see the Color theme list.

Setup screenshot

Next Step

Once you have your IDE setup, move to the next section to learn how to create a new C# Console Application project, and how to write text to the screen (Console Window).