FIXED csc is not recognized as an internal or external command

In this post, I’m going to show you how to fix csc is not recognized as an internal or external command or csc is not recognized so let’s go ahead and fix it.

Locate .Net Framework

It’s very simple, simply go ahead and launch your windows explorer window. You can also press windows key and letter E on the keyboard.
Then go to your this computer or this pc, then C drive then Windows and then look for You can look for a specific
folder by typing the folder name on the top or simply go ahead and locate it yourself by scrolling the directories.

I’m going to type the folder name, simply go ahead and type microsoft dot net and enter and then you’ll see framework, this is 32-bit everything 32-bit and this is 64 bit.
My system is 64-bit, i’ll go under framework 64. And these are the ccs packages C# packages, you can go with version two, three, three point five or four.

Copy .Net Package Path

I’ll go with the most latest one, go ahead and open it and you will see under this folder we have csc.exe. And we do not need that whole extension csc.exe path,
we just need the folder paths, go ahead and copy it.

Add .Net to System Variable Path

okay and then we need to go ahead and add it to the system variable path.
Now go ahead and click on the start menu type variable just type variable and then hit enter and then click environment variables.

you can either put under this user variable or go under system variable.
I always put in the system variable, go ahead and select path and click Edit and then click New and paste that folder location.

click ok ok ok.

Relaunch the CMD to Verify csc

now you must relaunch the CMD the command prompt, if you want to check the changes.
Now you can see now it’s been recognized

Compile & Run C# Sharp Code with CMD

  1. Navigate to folder where .cs files are
  2. Compile with csc file.cs
  3. csc command creates an .exe package
  4. Run file.exe with CMD

To compile the c-sharp code, navigate to the folder where the .cs file is and run the following command to compile it.

csc file.cs

This will create a file.exe package that you can run by it name with CMD