Building C# solutions from command line with Visual Studio 2010

Solution 1:

For solutions you can use:

devenv /build Release Solution.sln

or

devenv /build Debug Solution.sln

Solution 2:

if you open a visual studio command prompt from your start menu - then you can call MSBuild and give that either the .sln file or a specific .csproj file in order to build what you need

alternatively you can create a custom MSBuild file that takes care of the tasks.

one tip: make sure the version of MSBuild that you use is applicable to the target framework or tools version of the project

i.e. if you try and build a solution that was created in vs2010 with msbuild 3.5 then it will not recognise the 4.0 toolset of the project