Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is the MSBuild task ResolveProjectReferences taking a really long time?

I have a Silverlight 4 solution that takes a really long time to build from both VS2010 and the MSBuild 4 command line.

The solution contains 42 projects, one is a Silverlight application project, one web application project, and the rest are class libraries.

The MSBuild diag summary shows these tasks are taking some considerable time...

29891 ms  ResolveAssemblyReferences                 68 calls
115609 ms  CopySilverlightApplications                1 calls
131547 ms  ValidateXaml                              36 calls
425688 ms  ResolveProjectReferences                  68 calls
634031 ms  Build                                     71 calls

The project dependencies are quite well arranged, and the build order looks reasonable. I have all projects compiling into a single output folder, and all referenced have CopyLocal = false.

It appears the worst offender is the ResolveProjectReferences, but why should it be taking so long?

like image 629
Andronicus Avatar asked Jul 30 '10 11:07

Andronicus


2 Answers

Do you have the code analysis enabled on build? If so try to disable it. Had a similar issue. After disabling the code analysis the build run ~5 times faster.

like image 120
Al3x3 Avatar answered Nov 15 '22 23:11

Al3x3


ResolveProjectReferences has to build every referenced project. So it is possible, that some projects build multiple times.

Use file-references and a central build process to eliminate this problem.

i used this in a project once

we reduced our buildtime from 12 minutes to 3 minutes.

like image 41
mo. Avatar answered Nov 15 '22 23:11

mo.