Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to compile a project command-line with Visual C# 2010 Express edition?

Does an express edition of visual c# 2010 supports command-line builds?

like image 810
grigoryvp Avatar asked Nov 22 '09 15:11

grigoryvp


2 Answers

The C# compiler is part of the .Net Framework. If you have any VS2010 edition, including Express, you'd have to have .Net 4.0, so you'd have to have the command-line compiler. Typically lives under C:\windows\microsoft.net\framework\v4.xxx\

Also, if you just look in the output window in VS after a fresh build, you'll see the compiler. I have C# Express 2008, and when I build a new project:

------ Build started: Project: ConsoleApplication1, Configuration: Release Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /define:TRACE /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /debug:pdbonly /filealign:512 /optimize+ /out:obj\Release\ConsoleApplication1.exe /target:exe Program.cs Properties\AssemblyInfo.cs

Compile complete -- 0 errors, 0 warnings
ConsoleApplication1 -> C:\Users\brianmcn.brianmcn-7-home\AppData\Local\Temporary Projects\ConsoleApplication1\bin\Release\ConsoleApplication1.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

where

C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe 

is the compiler.

(MSBuild.exe will also be there if you want to build a .csproj.)

like image 62
Brian Avatar answered Apr 09 '23 11:04

Brian


I don't know if Express editions include it, but you can build from command line by invoking devenv using the /Build swicth: http://msdn.microsoft.com/en-us/library/xee0c8y7(VS.100).aspx

Anyway, you can also build Visual Studio solutions by using MSBuild. See here for a Visual Studio 2008 example: http://blog.benhall.me.uk/2008/07/msbuild-build-visual-studio-2008.html) (I guess that it will be very similar for Visual Studio 2010)

like image 33
Konamiman Avatar answered Apr 09 '23 13:04

Konamiman