Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IncrediBuild with DevEnv.exe vs MSBuild.exe

I use Xorax IncrediBuild to build Visual Studio 2013 (or later) solutions and projects, they're mostly .vcxproj with a bunch of .csproj ones.

It took me a little bit of digging, but I've learned that:

  • When IncrediBuild is used with the regular Visual Studio, it uses the Devenv.exe by default.

  • Since version 5.0, BuildConsole.exe supports a new switch: /UseMSBuild to specifically instruct IncrediBuild to use MSBuild's build engine instead of the default Visual Studio's DevEnv.

So, in case of Visual Studio projects, there are two modes available:

  • BuildConsole.exe MyProj.vcxproj which uses DevEnv.exe

  • BuildConsole.exe MyProj.vcxproj /usemsbuild which uses MSBuild.exe

I'd like to learn if there are any differences between using the two engines.

I have made some tests and observed that:

  • IncrediBuild "Initializing..." phase takes slightly longer in case of DevEnv.exe.

  • BuildConsole.exe generates different output, obviously.

  • No (or insignificant) difference in build performance.

In case of building individual C/C++ native projects (.vcxproj) as well as whole solutions (.sln), what are advantages and disadvantages of using DevEnv.exe versus MSBuild.exe?

like image 812
mloskot Avatar asked Jul 23 '15 09:07

mloskot


People also ask

What is the difference between MSBuild and Devenv?

Basically devenv (Visual Studio) wraps MSBuild and add lots of Visual Studio specific properties. To use devenv you need Visual Studio installed on your computer. To use MSBuild you only need to have the . NET framework.

Can I use MSBuild without Visual Studio?

To install MSBuild on a system that doesn't have Visual Studio, go to Build Tools for Visual Studio 2019, or install the . NET SDK. If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2022, it's installed under the Visual Studio installation folder.

What is MSBuild and do I need it?

The Microsoft Build Engine is a platform for building applications. This engine, which is also known as MSBuild, provides an XML schema for a project file that controls how the build platform processes and builds software. Visual Studio uses MSBuild, but MSBuild doesn't depend on Visual Studio.

How do you build specific targets in solutions using MSBuild exe?

To build a specific target of a specific project in a solution. At the command line, type MSBuild.exe <SolutionName>. sln , where <SolutionName> corresponds to the file name of the solution that contains the target that you want to execute.


1 Answers

** disclaimer: I work at IncrediBuild **

We've determined together with Microsoft that in order to get builds that behave in the same manner as building from within Visual Studio (without IncrediBuild), DevEnv should be used. MSBuild executes builds in a slightly different manner than VS both in the build output it produces and in the way it behaves when executing custom steps and some other minor things. If a user wants IncrediBuild builds to behave in the same manner as he is used to when building from Visual Studio, the default way should be used (IncrediBuild executing DevEnv). If a user is used to execute his builds using MSBuild, whether from the command line or through TFS, the UseMSBuild switch should be used. We wanted to allow users to choose the way they would like IncrediBuild to work depending on the way they are used to do that, same as Microsoft supporting both DevEnv and MSBuild.

Additional comments:

  1. The initialization stage is indeed longer when using Devenv, since devenv loads and parses the solution and .vcxproj files in a different manner than msbuild. The more Projects a solution has – the longer this phase should take. The increase of time it takes this phase to complete usually greatly offset by the speed increase in the actual build time – when building several projects at the same time.
  2. Devenv is highly recommended for our Predicted Execution feature which can provide up to 20% of additional build acceleration due to the above way of work which would be not possible using MSBuild.
like image 192
avi Avatar answered Oct 08 '22 03:10

avi