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.

afuzzyllama
  • 6,538
  • 5
  • 47
  • 64
Jengo
  • 1
  • 5

1 Answers1

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.)

Jon Skeet
  • 1,421,763
  • 867
  • 9,128
  • 9,194
  • 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 :-) – Eric J. Oct 13 '15 at 02:15
  • @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...) – Jon Skeet Oct 13 '15 at 02:16
  • @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 Oct 13 '15 at 02:23
  • @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... – Jon Skeet Oct 13 '15 at 02:25
  • @JonSkeet I'm just going to use VS 2015, and come back to doing it through the command line another time. – Jengo Oct 13 '15 at 02:27