Sunday, May 5, 2013

Fixing the csc.exe issue


I had to write fairly small programs in C# of late and did not feel like using the IDE, however I ran into the path setting problem. My command line was not able to call the csc.exe to compile my code. The error:  'csc' is not recognized as an internal or external command, operable program or batch file. This is what I did to fix it:

1. Locate 'csc.exe' on your PC. Here is thing which I don't know. I have googled this issue and people suggested  to add Framework location and other folders. Also, on my box I have csc.exe on multiple locations none of them worked for me except for this one. c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC. Copy this address on a notepad.

2. Go to Control Panel\System and Security\System and click on Advanced system settings on your left, if you are admin you can access else call the admin. Once you click on Advanced System Settings click on environment variables which will open a dialog box look for System Variables under that you have multiple system variables. Select path and click edit

3. Carefully copy the address which is on notepad and add it to the end of the variable value list. click ok, twice and viola you are ready. Now you should be able to access csc from cmd prompt. 

Happy Coding!!

No comments:

Post a Comment