Is it possible to install a C# compiler without Visual Studio?

后端 未结 11 2226
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 21:32

I want to build projects from the command line. Is it possible to deploy a C# compiler without installing Visual Studio?

11条回答
  •  星月不相逢
    2020-11-29 21:51

    Sure, the framework includes a compiler, csc.exe. Look at this article for a quick how-to. The important parts:

    You can get the command-line compiler (csc.exe) from Microsoft site http://msdn2.microsoft.com/en-us/netframework/aa731542.aspx.

    Download the redistributable package of the .NET Framework, which includes the compiler and the .NET Framework with C# 2005 syntax support.

    The compiler is located in the following directory: %windir%\Microsoft.NET\Framework\

    Also look at this MSDN article for a full guide and explanation.

    Note that for more recent versions, you will be looking for the MSBuild standalone package rather than the framework -- see @Vadzim's answer.

提交回复
热议问题