0

I'm trying to compile my C# file with the command line by executing the csc (file name) command. I don't want to use an IDE because I prefer the command line right now.

However the csc command is not found I believe because the .NET framework is not properly installed.

I've installed visual studio, but csc not not come with it.

What do I have to install to get access to the csc compile command?

The error is 'csc' is not recognized as an internal or external command.

1
  • 1
    Since you like the command line, dir C:\csc.exe /s Commented Oct 13, 2015 at 2:14

1 Answer 1

3

However the csc command is not found I believe because the .NET framework is not properly installed.

It's far more likely that you just haven't got it in your path.

If you've installed Visual Studio, one of the tool shortcuts associated with it should be "Developer Prompt" which will create appropriate path entries for that shell...

As an example, try running it with a full path to csc.exe, e.g.

"c:\Program Files (x86)"\MSBuild\14.0\bin\csc.exe

(That's where mine's being picked up from.)

Sign up to request clarification or add additional context in comments.

5 Comments

And if Visual Studio is not installed, it's in the .NET Framework folder (various sub-paths depending on the .NET version). dir C:\csc.exe /s for command line buffs :-)
@EricJ.: Yes, although I don't believe the .NET framework comes with Roslyn yet (at least, if I run the version of csc that's in the framework directory, it shows up as the C# 5 compiler...)
@JonSkeet Thanks, however I can't find csc in the Visual Studio Path. I'm using 12.0, so the path's are pretty different.
@Jengo: So now's the time to search your drive for csc.exe - or install a newer version of Visual Studio, given that 2015 Community Edition is free and pretty powerful...
@JonSkeet I'm just going to use VS 2015, and come back to doing it through the command line another time.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.