简体   繁体   English

用于C#代码的csc编译器

[英]csc compiler for C# code

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. 我正在使用Visual Studio2015。我认为它使用Microsoft Visual Studio 14.0 \\ VC \\ bin文件夹中的cl.exe编译器来编译C ++代码。 Also, my understanding is that the compiler used to compile C# code is csc.exe. 另外,我的理解是,用于编译C#代码的编译器是csc.exe。 However, I could not find this csc.exe inside my visual studio like cl.exe. 但是,我在视觉工作室(如cl.exe)中找不到此csc.exe。 I am curious to know how visual studio compiles C# code then. 我很好奇,然后知道Visual Studio如何编译C#代码。 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. 我认为Visual Studio使用.Net附带的csc.exe(通常安装在C:\\ Windows \\ Microsoft.NET \\ Framework \\\\ csc.exe中)来编译C#代码。 Is my understanding correct ? 我的理解正确吗?

I cannot answer why Roslyn is not present in your VS 2015 install dir. 我无法回答为什么VS 2015安装目录中不存在Roslyn。 But you can examine how Visual Studio runs the csc.exe in the output window. 但是您可以检查Visual Studio如何在输出窗口中运行csc.exe。

Go to Tools->Options->Projects and Solutions->Build and Run , and select the build output verbosity. 转到Tools->Options->Projects and Solutions->Build and Run ,然后选择Tools->Options->Projects and Solutions->Build and Run输出的详细程度。 (you can select the most verbose option) (您可以选择最详细的选项)

在此处输入图片说明

Then build your program. 然后构建您的程序。 You can then check the command line used by MSBuild in the output window. 然后,您可以在输出窗口中检查MSBuild使用的命令行。

Something like, ooh, I am using VS 2017... 哦,我正在使用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) C:\\ Program Files(x86)\\ Microsoft Visual Studio \\ 2017 \\ Professional \\ MSBuild \\ 15.0 \\ Bin \\ Roslyn \\ csc.exe / noconfig / nowarn:1701,1702,2008 / nostdlib + / platform:anycpu32bitpreferred ...的开关省略)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM