locked
cannot find csc.exe after installing Visual C# 2010 Express

    Question

  • I installed Visual C# 2010 Express on a windows 7 machine, but I cannot find csc.exe, the command line editor for C#, anywhere on my computer. 

    Thanks, Jeremy

    Thursday, March 17, 2011 12:06 AM

Answers

  • This happens because csc is a console application. When you double click on it, it runs and when it finishes the console is closed. Since you have provided no parameters, csc doesn't do anything when it runs. You need to open a console window, navigate to where csc (or add it to your path as above) then run it. You should get an error message :)

    This should help with the options available


    Ron Whittle - If the post is helpful or answers your question, please mark it as such.
    Saturday, March 19, 2011 7:50 PM
  • Note that you should not modify your main path variable (Control Panel\System -> Environment variables) to include the compiler because if you target different .NET versions you'll end up potentially using the wrong compiler.  You should remove any changes you made. 

    If you want a command prompt from which you can compile code over and over again (although you should really be using VS instead) then you can use Visual Studio Command Prompt from the Start Menu.  This opens a command prompt with all the appropriate paths set.  Note that you should not modify your main path variables to include the compiler because if you target different .NET versions you'll end up potentially using the wrong compiler.

    Michael Taylor - 3/21/2011
    http://msmvps.com/blogs/p3net

    • Marked as answer by Mio_Miao Tuesday, March 29, 2011 11:49 AM
    Monday, March 21, 2011 3:01 PM

All replies

  • You have to add the path for the csc.exe. To add the path go to your control panel>system>Advanced system settings>click on the advanced tab>Environment Variables...>under system variables double click on path>for the variable value add ";C:/Windows/Microsoft.NET/Framework64/v4.0.30319" without the quotations>click ok out of that and you should be able to compile your .cs files now.
    Thursday, March 17, 2011 1:57 PM
  • Thanks -- I added the path (and flipped the slashes to be consistent with the other paths) and rebooted, but the same thing happens... I double click on csc.exe and the black console appears and disappears immediately.  I've also downloaded the 4.0 framework and reinstalled it with no luck.
    Friday, March 18, 2011 12:32 AM
  • This happens because csc is a console application. When you double click on it, it runs and when it finishes the console is closed. Since you have provided no parameters, csc doesn't do anything when it runs. You need to open a console window, navigate to where csc (or add it to your path as above) then run it. You should get an error message :)

    This should help with the options available


    Ron Whittle - If the post is helpful or answers your question, please mark it as such.
    Saturday, March 19, 2011 7:50 PM
  • Note that you should not modify your main path variable (Control Panel\System -> Environment variables) to include the compiler because if you target different .NET versions you'll end up potentially using the wrong compiler.  You should remove any changes you made. 

    If you want a command prompt from which you can compile code over and over again (although you should really be using VS instead) then you can use Visual Studio Command Prompt from the Start Menu.  This opens a command prompt with all the appropriate paths set.  Note that you should not modify your main path variables to include the compiler because if you target different .NET versions you'll end up potentially using the wrong compiler.

    Michael Taylor - 3/21/2011
    http://msmvps.com/blogs/p3net

    • Marked as answer by Mio_Miao Tuesday, March 29, 2011 11:49 AM
    Monday, March 21, 2011 3:01 PM