I turned back towards the resistance base when the guy suddenly shouted, "What tool do you use to write your code?"
"I use a keyboard to type, and..." but he interrupted me:
"Are you kidding, man? I mean what IDE do you use?" He was laughing as if I had intentionally made a joke.
"What is an IDE?" I asked.
"IDE stands for Integrated Development Environment. It's a software tool where programmers write code. It looks like a very cool text editor but includes a shitload of features. You should definitely know and use one for C#. I'm guessing you don't?"
"No, I was writing code wherever people asked me to... I don't know how it all works." I replied.
"Yo, man! You don't need to know HOW an IDE works. Just learn how to use it, kid!"
"Okay then, what IDE do you use?" I asked.
"I have a Visual Studio 2019 tutorial that I downloaded from the darknet network a few years ago," he replied, "It works both for C and C#. Try it! You are smart, kid, you can find it! I need to go now, see ya in hell!"
"What? Hell? Why in hell? Was that a joke or a threat? Wait!" I tried to get the man's attention but he had bolted off and was already around a corner. There was only me and a virtual screen with the Visual Studio 2019 tutorial.
Visual Studio is a full-featured integrated development environment (IDE) for Android, iOS, Windows, web, and cloud. We are going to use it for C# development under Windows. Visual Studio provides various tools to make development more comfortable, enjoyable, and efficient. Visual Studio came in second in a list of the most popular developer environments in 2019. The only IDE ranked higher was... also Visual Studio (a different version)!
Before we dive into the magic behind IDEs, let's go over the main advantages of using Visual Studio:
Follow these 8 simple steps to set up Visual Studio and the Codeasy extension.
Find a computer with Microsoft Windows 7/8.1/10. The Codeasy extension that you will install in this lesson runs only on Windows.
Install Visual Studio 2019 Community Edition. Start by watching this installation tutorial. Then download Visual Studio here.
When installation is complete, choose the dark scheme (your eyes will thank you after your first long coding session) as shown in the installation tutorial.
Create a C# console application by clicking File > New > Project.
In the resulting window, choose Visual C# in the left list and then Console App (.NET Core) in the right. Click next, enter a Name for your project (we use SaveTheWorldWithCodeasy in the example below). You can only use Latin characters, and no spaces are allowed. Click OK when finished.
Run your first program. When you finish Step 3, a new project opens with a new file, Program.cs, open for editing.
Take a minute to explore the environment. The main window is the Code Editor, which is where you write the code. A smaller window to the right, the Solution Explorer, provides a tree view of the project from which you can choose the files that you want to edit.
Now that you're acquainted with the environment, let's run our first program. Start with some optimism - insert the following code into the main method:
Console.WriteLine("I write code as professional programmers do!");
Then press Ctrl+F5 on the keyboard, and you'll get the program output in the console:
If you run into any difficulties, watch Building your first app.
In fact, take a moment to contemplate those happy human faces on the videos that we provide. These materials were created before the war with the machines, which is why you see so many smiles and joyful intonations.
View the compiler output. As you know, when you make mistakes in the code, C# lets you know. The thing that generates those error messages that appear is called the compiler. We'll come back to the definition of the compiler, but for now, let's find where compiler errors are printed. For example, put an intentional mistake in your code by deleting the semicolon at the end of the Console.WriteLine command:
Console.WriteLine("I write code as professional programmers do!")
Press F5 (or if that doesn't work, Ctrl+F5) on the keyboard, and you'll get the following warning:
Select the Do not show this dialog again check box and click No. The next time it encounters an error, Visual Studio will show you the compiler errors in the Error List panel, as shown below.
If you double-click the error message, the cursor will be placed at the location where that error occurred. Magic! For now, put the semicolon back in your code.
Before we continue, I want to clarify one thing. You'll often hear the term Build, as in build a project, build a solution, etc. The easiest way to think about it for now will be as a check for errors. Code building is a process of finding misspellings in commands and other things that the compiler doesn't understand. The term Build is sometimes referred to as compilation. In Visual Studio, you build your code by pressing Ctrl+Shift+B or by right-clicking on the project name in the Solution Explorer and clicking Build Project. This action checks for errors but does NOT run your program. To run a program, you must press F5 or Ctrl+F5, or click the Start button in the top menu.
Install the Codeasy Visual Studio Extension. In Visual Studio 2019, click Tools > Extensions And Updates > Project. In the resulting window, choose Online in the left menu. Then type Codeas in the search field. The Codeasy extension should appear on the screen.
Click Download to begin the installation, and then close Visual Studio. In the dialog window that appears, click Modify.
Find your project (SaveTheWorldWithCodeasy) in the Recent list and select it.
Once your project loads, click View > Other Windows > Codeasy Extension from the toolbar.
The extension window will open at the bottom of the screen. There are tabs at the bottom of the window that let you change what is shown in the window (Error List, Breakpoints, etc.). The thumbtack button in the upper right corner of the extension window (shown circled in green in the following image) will pin the Codeasy extension window so that it is always visible on the screen.
Once you're logged in, you'll see three lists in the extension window: Chapter, Lesson, and Task.
Some of the chapters will be grayed out to begin with. As you progress through lessons, you'll be able to activate them. You've already done this with Chapter 3: Back to the streets on the website.
After you activate a new chapter, click the Refresh button (shown below) in the extension to update the Chapter view.
Load and solve tasks. Time to do something awesome! First, make your code in Program.cs. Then compile (which means fix) all mistakes in our experiments. Remember, to check for mistakes (or compile), press Ctrl+Shift+B or right-click the project name in the editor and select Build. Then click on the third chapter, third lesson (Visual Studio Extension), and the first task (First task from VS). This is how you choose a specific task in extension. Finally, click the Load button (shown below) to load the task contents into your SaveTheWorldWithCodeasy project. Note that you must have an internet connection to load tasks from Codeasy.
Upon loading the task contents, you'll see that folders with the chapter and lesson names were added to your project in the Solution Explorer. There will also be a new file with the name FirstTaskFromVs.cs that includes some predefined code. If you close a tab in the code editor by mistake, don't worry! Just double-click the file name in the Solution Explorer to open the file again.
Find and read the task description (shown circled in orange below).
Now, try to run the task by pressing Ctrl+F5. As you'll see, the console window will open with just the phrase "Press any key to continue...". This is because the task currently does not output anything to the screen. Completing the task is your job!
Check your solution. Let's try to check this task. Press the Check button (circled in red above). Because you have not completed the task (yet!), you'll receive a FAIL prompt.
Let's change a few things. Solve the task by adding the specified text using a Console.WriteLine(); command, and click the Check button again. If your solution matches the task, you'll receive a SUCCESS prompt as shown below.
The icon for that task in the extension window will also change to a green checkmark, indicating that you've completed the task. Good job! You can now check your leaderboard position on the Codeasy website.
Here is a summary of how to start solving tasks with the Codeasy Visual Studio Extension:
The following is a list of things you can do with the Codeasy Visual Studio extension:
Finally, here are some things that are good to know about Codeasy's Visual Studio extension: