Welcome | Hello World with CMD | Creating the File | Accessing the C# compiler | Compiling the code | Execution | Questions | Contacts | Developer
Hello, welcome!
I had the idea to start the #100DaysOfCode challenge, in addition to sharing some projects for those interested in learning C#, so it's something very simple for those who would like to start programming or need to improve their skills.
📚 Take advantage of the code for this exercise
👩💻 Redo it your way
😉 If you have any questions, contact me
-
Create a folder on your computer to place the application.
-
Create a new Text Document and name it without spaces in the title.
-
Copy the following code into your txt file:
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Running Project 1 - Hello World:");
Console.WriteLine("Olá mundo! Hello world!");
Console.WriteLine("The run has ended.");
Console.WriteLine("Press Enter to finish...");
Console.ReadLine();
}
}
- Use your computer's File Explorer to navigate through Windows directories to the Microsoft.NET Framework folder.
- Path where the folder is usually located on the computer: C:\Windows\Microsoft.NET\Framework
- Open the version 4 folder that has the files used by the CLR (common language runtime).
Common Language Runtime (CLR) Overview
.NET provides a runtime environment, called the Common Language Runtime, that executes code and provides services that facilitate the development process.
To learn more about CLR, click here!
- In this folder you will find the csc.exe file, copy the path of this file
-
Example: c:\Windows\Microsoft.NET\Framework\v4.0.30219\csc.exe
csc: C Sharp Compiler
C# Compiler Options
This section describes the options interpreted by the C# compiler.
To know more about compiler, click here
-
Press the "Windows" key.
-
Type "cmd".
-
Open Command Prompt.
-
Type in the Prompt: cd "path of the folder where you saved the application" and press Enter.
- Example: cd C:\Users\Fulano\Documents\FolderExercise
- Paste the path of csc.exe, leave a space, paste the name and extension of your application file and press Enter.
- Example: c:\Windows\Microsoft.NET\Framework\v4.0.30219\csc.exe Exercise.txt
💬 Note: To confirm that it worked, go to your application's directory with the File Explorer to check if the executable of your code appeared: "Exercise.exe".
- To execute with Prompt type the name of the file and press Enter.
- Example: Exercise.exe
- Ready! Now it will be possible to see the execution of your application, because the message that you typed in your code will appear in the Prompt.
C:\Users\Fulano\Documents\FolderExercise>c:\Windows\Microsoft.NET\Framework\v4.0.30219\csc.exe Exercise.txt
Microsoft (R) Visual C# Compiler version 4.8.4084.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
C:\Users\Fulano\Documents\FolderExercise>Exercise.exe
Hello World!
- c:\Windows\Microsoft.NET\Framework\v4.0.30219\csc.exe Exercise.txt
- Exercise.exe
‼ Note 2: Always follow the syntax rules of the language - C# is case sensitive, we must pay attention when writing keywords / reserved words, as some of them must start with capital letters, others with capital letters, and all must be written in exact and correct way for applications to work.
Any questions, interact here:
- Make questions
- Give suggestions for improvement to the project
- Share your ideas
- And interact on the subject
😉 Remember this is a community we build together 💪.
If you need help, contact me 😉
✏️ Created with ❤️ e C# by Ana Valentim.
💙 If you liked this project, give it a ⭐ and share!

