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

后端 未结 11 2231
爱一瞬间的悲伤
爱一瞬间的悲伤 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:50

    Latest Microsoft .NET Framework 4.7 doesn't include C# compiler anymore.

    But it can be installed as part of standalone MSBuild tool.

    Go to https://www.visualstudio.com/downloads/, scroll down to "Other Tools and Frameworks" and choose "Build Tools for Visual Studio 2017".

    After "Visual Studio Build Tools 2017" Online Installer runs, switch to "Individual components" tab and check "C# and Visual Basic Roslyn compilers". This would also check MSBuild dependency. All together less than a hundred of megabytes.

    The compiler installs at C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\Roslyn\csc.exe.

提交回复
热议问题