Monday, December 15, 2008

Visual Studio Command Line Build Troubles

You can build Visual Studio projects by the command line with the following switches

devevnv.exe /rebuild

to rebuild the entire solution. For example

devenv.exe my_solution.sln /rebuild Release

or to build a single project

devenv.exe my_solution.sln /project MyProject /rebuild Release

I've found two ways in which Visual Studio command line builds fail for solutions which otherwise build in the IDE. The first problem is the out of order build, where the project dependencies seem to be ignored, and a project is not built soon enough in the build, causing libraries to not be found. The other problem I find is Visual Studio crashing outright during a command line build.

I found today that Visual Studio allows for multiprocessor builds. These don't work in Visual Studio 2005 or 2008 command line builds, and must be disabled if you do command line builds.
  1. Select tools/options
  2. In the options dialog, select Projects and Solutions/Build and Run
  3. In the Build and Run options, set maximum number of parallel project builds to 1.
Happy coding,

The Schmitzer

No comments: