0

I am using Visual studio 2015. I think it uses the cl.exe compiler which is inside the Microsoft Visual Studio 14.0\VC\bin folder to compile C++ code. Also, my understanding is that the compiler used to compile C# code is csc.exe. However, I could not find this csc.exe inside my visual studio like cl.exe. I am curious to know how visual studio compiles C# code then. I think Visual Studio uses the csc.exe which comes with .Net, generally installed in C:\Windows\Microsoft.NET\Framework\\csc.exe to compile C# code. Is my understanding correct ?

3
  • 1
    I have just answer another question on this topic. Please check. Visual Studio 2015 uses the default Roslyn compiler, not the one shipped with .NET Framework. Commented Jun 20, 2018 at 3:45
  • Thanks, I went through the link. Inmycase, my visual studio 2015 does-not have Roslyn\csc.exe. Basically it does-not have csc.exe installed. So in this case, can we assume it is taking csc.exe from my .Net installation? Commented Jun 20, 2018 at 4:03
  • Did you install VS2015 or did someone else install it? Was the option to install C# unticked? Commented Jun 20, 2018 at 4:20

1 Answer 1

1

I cannot answer why Roslyn is not present in your VS 2015 install dir. But you can examine how Visual Studio runs the csc.exe in the output window.

Go to Tools->Options->Projects and Solutions->Build and Run, and select the build output verbosity. (you can select the most verbose option)

enter image description here

Then build your program. You can then check the command line used by MSBuild in the output window.

Something like, ooh, I am using VS 2017...

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /nowarn:1701,1702,2008 /nostdlib+ /platform:anycpu32bitpreferred ... (a bunch of switches omitted)

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

1 Comment

Thanks got it, I see in mycase it is taking csc.exe from the following path -- C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.