views:

845

answers:

8

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

+8  A: 

Yes, if you have .net sdk, it's there, e.g.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe

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

Brian
csc.exe is included in the .NET Framework, what most people think of as the runtime. You don't need the SDK to get the compiler. Let me say that again: you don't need the SDK to get the C# compiler. The VBC and CSC compilers come with the .NET Framework.
Cheeso
+1  A: 

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

Here's a link that can help you.

Vadim
you don't need the sdk, but it does give you the command-line environment which makes building easier
benPearce
+1  A: 

You only need the FrameWork. You can use a notepad to edit and the CSC.exe to compile.

Best Regards!

MRFerocius
+7  A: 

Sure, the framework includes a compiler, csc.exe. Look at this article for a quick how-to and this MSDN article for a full guide and explanation.

lc
Is it possible to compile a solution not just .cs files?
SeasonedCoder
Yes, that's what msbuild.exe is for. (It can definitely handle .csproj, and I think maybe .sln too.)
Brian
MSBuild has no problems with .sln files
DaveE
+10  A: 

Of course. Do:

sudo apt-get install mono-gmcs

Sorry. :) Everyone else assumed Windows and MS .NET, so...

Matthew Flaschen
+1 for out of box thinking
Greg Ogle
+1 for Ubuntu... :)
Dave Swersky
+2  A: 

Yes, there is even a open source IDE Sharpdevelop you can set the compiler as a command in Ultraedit (or some other editor of preference) etc.

Dan
+4  A: 

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

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 ;) )

pyrochild
A: 

Hi, 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