views:

306

answers:

1

We have a Visual Studio 2005 solution with 50 projects (mostly class libraries and some Win Form projects).

Doing a clean debug build with a freshly started Visual Studio peak memory usage (recorded by task manager) shows about 500mb.

Doing the same build (clean, debug) with MSBuild the peak memory usage is about 1600mb and it eventually fails with an OutOfMemory exception.

This is the command I'm executing:

MSBuild LargeProject.sln /target:clean;build /nologo /property:Configuration=debug /verbosity:minimal

Both were run on the same PC which has Windows XP Professional 32bit with 2gb of physical ram.

I found this MSDN article describing the differences between building in Visual Studio and MSBuild but does not explain why the build requires 3 times the memory.

Does anyone know why this happens? And if there is something that I can do to reduce the memory requirements of MSBuild.

A: 

I removed a project from the Visual Studio solution that was referenced by almost all of the other projects. Then changed the projects to reference the project's dll instead of the project. This dropped the memory usage of MSBuild from 1600mb to about 1200mb (400mb difference) and was successful.

The removed project was not very large about 5 classes and the final debug dll was 40kb and the release version 28kb. The project has 3 references Microsoft.VisualBasic.Compatibility, System and System.Windows.Forms.

I tried removing other projects from the solution which were referenced less but MSBuild still failed with an OutOfMemory exception.

Sameer Kalidas