5

I making fast changes in my code via Visual Studio Code. As you know it doesn't have build-in compiler so I using CSC via CMD.

It's working good only for ( code <= C# 4.6 & code <= .NET 4.5 ) because that version of CSC I have.

And there is problem because I writing in new C# 6.0 and .NET 4.6 and can't compile via CSC. I have installed VS 2015 with .NET 4.6 and compilie via VS 2015 working good.

I can't find CSC in version witch support CSC in version .NET 4.6 in my computer. I have .NET 4.6 in Windows Registry(regedit).

Ajay2707
  • 5,690
  • 6
  • 40
  • 58
Nerf
  • 938
  • 1
  • 13
  • 30
  • 1
    I'll randomly guess you are using the wrong csc.exe, there are lots of them. You can see the one VS2015 uses when you change the build verbosity to Normal. Tools > Options > Projects and Solutions > Build and Run. It runs C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe – Hans Passant Jul 29 '15 at 11:13
  • @HansPassant Yeah, but that's only there when you have VS2015 installed. It's a shame the compiler is no longer a part of .NET Framework itself... – Luaan Jul 29 '15 at 11:15
  • Hmya, not everybody likes open source I suppose: "what, I have to *compile* it?" Yes. – Hans Passant Jul 29 '15 at 11:30

2 Answers2

6

csc.exe compiler used by Visual Studio 2015 is located at c:\Program Files (x86)\MSBuild\14.0\bin\csc2.exe

Pavel Krymets
  • 6,253
  • 1
  • 22
  • 35
4

CSC is no longer used for compilation of C# 6+. The new standard compiler is Roslyn now.

In fact, csc itself tells you this:

This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240

You need to download Roslyn (either using the link above and compiling it for yourself using MSBuild, or via NuGet at http://www.nuget.org/packages/Microsoft.CodeAnalysis.CSharp/) and use it to compile your programs from now on.

Luaan
  • 62,244
  • 7
  • 97
  • 116