MSBuild vs devenv for command line builds

25,011

Solution 1

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.

Solution 2

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

Solution 3

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:

Solution 4

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

Solution 5

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.

Share:
25,011
Filip Frącz
Author by

Filip Frącz

I'm a Chicago-based software engineer specializing in high frequency trading applications. Currently employed at Chicago Trading Company. Previously I worked at Thomson Reuters and Trading Technologies on mobile and TT SDK for the next-gen Debesys aka TT trading platform. C++, C#, Java, Microservices

Updated on May 06, 2020

Comments

  • Filip Frącz
    Filip Frącz almost 4 years

    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

  • Alisettar Huseynli
    Alisettar Huseynli almost 4 years
    this link is broken
  • Christian.K
    Christian.K almost 4 years
    Yeah! They shuffled around the whole blog system a while ago. I update the link with a version, that I think is what it was.