.NET Framework (pronounced dot net) is a software framework developed by Microsoft that runs primarily on Microsoft Windows.-Wikipedia .Net frameworkHere we will learn how to prepare for programming with C#.
We suppose that you are using windows 7 OS. At first, we must set the environment variable for C#. Open your explorer then move as follows:
Start --> Computer --> Windows --> Microsoft.NET --> Framework (if you are using OS 64bit version, choose Framework64) --> (choose the latest version like "v4.0")
Then copy the path as follows:
When you've done copying it, we will move to "Environment Variables" as follows:
Start --> Right-Click on Computer --> Properties --> Advanced system settings --> Environment Variables
Then look for Environment variables and click it.
You will see the following window. If there is an item called "PATH", edit it. If you don't find "PATH", click "new" button and make a item named "PATH" in the user variable pane.
If you've clicked "Edit", add the path of Microsoft.NET's framework which you have copied. Please add ";" in the end of the path unless ";" is already there:
example: ;C:\Windows\Microsoft.NET\Framework64\v4.0.30319
or
C:\Windows\Microsoft.NET\Framework64\v4.0.30319
↓
like this
If you've clicked "New", name it as "PATH" then add the path without adding anything. If you've clicked "New", you don't need to put anything in front of the path.
example: C:\Windows\Microsoft.NET\Framework64\v4.0.30319
add this path to Environment Variables.
Now you can use C#'s command on CMD.
We will check if the new environment variable is working. Open your CMD. Then write as follows:
csc
Then push the enter on your physical keyboard.
If you see this Microsoft's message and "warning CS2008"(plus some message) and "error CS1562"(plus some message), that means you've succeeded the environment variable setting.
When you create a C# program, use this "csc" command after moving to the folder which has the .cs file:
csc Sample.cs
Then you can create a .exe file if there aren't any errors in the source file.
To move to the targeted folder, use cd command:
cd C:\Users\Documents\C#
like this