Question

I was wondering: what is the difference between using msbuild and devenv when compiling solutions from the command line?

One obvious thing noticed was that msbuild does build dependent projects not contained within the solution, while devenv does not.

Are there any other? Are there some special flags one could pass to msbuild to make it match the devenv build exactly?

P.S. I'm using Visual Studio 2010 SP1

Was it helpful?

Solution

According to this MSDN Blog Entry they try to minimize the differences, but those that exist (i.e. using an integrated C# compiler instead of csc.exe or setting the BuildingInsideVisualStudio property) are mainly done to optimize the performance of builds.

OTHER TIPS

The main advantage of MSBuild is that you don't need to have Visual Studio installed.

One limitation of MSBuild is that it does not support building Visual Studio setup projects (.vdproj).

(You can work around this by defining an exec task which calls devenv, but then you still need Visual Studio.)

I have experienced a project within a multilayer team: developers, testers, deployers. MSBuild was the main tool of the deployers: they could compile and recompile, just setting building parameters editing the xml config file of MSBuild without opening the devenv. In fact, they often used MSBuild in pre-prod environment where there was not devenv at all.

Nant is a similar tool by Apache Foundation.

For further info have a look here:

Another major difference is that msbuild has some options that don't exist for devenv. As far as I can tell, there is no way to increase verbosity for devenv but you can increase the verbosity for msbuild by the option:

/v:diag

I encountered a case where devenv wrote an error message when a project file was missing, but returned 0 anyway. By contrast, msbuild returned a nonzero value. I switched our makefile over to using msbuild so we wouldn't overlook errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top