Is it possible to build MSBuild files (visual studio sln) from the command line in Mono?

MsbuildMono

Msbuild Problem Overview


Is it possible to build Visual Studio solutions without having to fire up MonoDevelop?

Msbuild Solutions


Solution 1 - Msbuild

Current status (Mono 2.10, 2011): xbuild is now able to build all versions of Visual Studio / MSBuild projects, including .sln files. Simply run xbuild just as you would execute msbuild on Microsoft .Net Framework. You don't need Monodevelop installed, xbuild comes with the standard Mono installation.

If your build uses custom tasks, they should still work if they don't depend on Windows executables (such as rmdir or xcopy).

When you are editing project files, use standard Windows path syntax - they will be converted by xbuild, if necessary. One important caveat to this rule is case sensitivity - don't mix different casings of the same file name. If you have a project that does this, you can enable compatibility mode by invoking MONO_IOMAP=case xbuild foo.sln (or try MONO_IOMAP=all). Mono has a page describing more advanced MSBuild project porting techniques.

Mono 2.0 answer (2008): http://www.mono-project.com/Microsoft.Build">xbuild</a> is not yet complete (it works quite well with VS2005 .csproj files, has problems with VS2008 .csproj and does not handle .sln). Mono 2.1 plans to merge the code base of mdtool (MonoDevelop command line build engine) into it, but currently http://www.monodevelop.com/MonoDevelop_1.0_Released#Command_line_tools">mdtool</a> is a better choice. mdtool build -f:project.sln or http://ubuntu.dustinkirkland.com/manpages/intrepid/man1/mdtool.html">`man mdtool` if you have MonoDevelop installed.

Solution 2 - Msbuild

for now as per August 2017 we can use

msbuild

command as xbuild is depreciated.

Solution 3 - Msbuild

xbuild now supports solutions and projects, both VS2005 and VS2008.

Solution 4 - Msbuild

I think you are looking for xbuild: http://www.mono-project.com/Microsoft.Build

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKris EricksonView Question on Stackoverflow
Solution 1 - MsbuildskolimaView Answer on Stackoverflow
Solution 2 - Msbuildprofesor79View Answer on Stackoverflow
Solution 3 - MsbuildradicalView Answer on Stackoverflow
Solution 4 - MsbuildGEOCHETView Answer on Stackoverflow