Is it possible to install a C# compiler without Vi

2019-01-07 07:55发布

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

11条回答
再贱就再见
2楼-- · 2019-01-07 08:01

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.

查看更多
Evening l夕情丶
3楼-- · 2019-01-07 08:06

Yes, if you have the .NET SDK, it's there. For example,

C:\WINDOWS\Microsoft.NET\Framework\v[your version number]\csc.exe

msbuild.exe should be there too, and you can use that to build project (.csproj) files.

查看更多
男人必须洒脱
4楼-- · 2019-01-07 08:06

You only need the .NET framework. You can use Notepad to edit and the CSC.exe to compile.

查看更多
叛逆
5楼-- · 2019-01-07 08:12

Contrary to what some of the other answerers say, you do NOT need the SDK, just the .NET Framework to get the C# compiler, csc.exe.

Also, consider other (free) IDEs like MonoDevelop, #develop, and Visual C# Express. (You said you don't want Visual Studio, not that you don't want an IDE at all ;) )

查看更多
ら.Afraid
6楼-- · 2019-01-07 08:12

Like some others have mentioned MSBuild is deployed with the .NET Framework (versions 2.0 and 3.5) so if you have either of those installed you can build your applications without needing Visual Studio installed on the machine.

Sayed Ibrahim Hashimi

My Book: Inside the Microsoft Build Engine : Using MSBuild and Team Foundation Build

查看更多
唯我独甜
7楼-- · 2019-01-07 08:18

Yes, but you need to download and install .NET Framework SDK.

Here's a link that can help you.

查看更多
登录 后发表回答