Recently I've found that one of our Hotfix Branches was taking a long time to compile (15min or more). This was strange because our main development branch was OK and compiling the same Visual Studio solution in under 3 minutes. The only difference was that in the hotfix branch we still had the project in .NET 2.0.
I saw right away that ResGen.exe (Resource Generator) was executing for a long time and consuming 25% CPU (I guess it would use more CPU if it was multi-threaded :))
The problem you face when you try to solve problems regarding compilation time is that it is very hard to see what is actually taking more time to compile because MSBuild.exe does not provide a complete and easy way to get time metrics.
Although you can call MSBuild in verbose mode it does not tell you within each project what took longer to compile.
The technique I used to figure out what was going on was to use Process Monitor from Microsoft (made by Mark Russinovich, which I had the opportunity to meet at TechEd Europe last year, and Bryce Cogswell).
So I ran ProcessMonitor and filtered all the results by process name "ResGen.exe" and watched the log while the solution was compiling.
What I found was quite horrific :) ResGen was trying to repeatedly find .NET assemblies in specific versions that do not exist like System.Windows.Forms, Version=184.108.40.206 or System.Drawing, Version=220.127.116.11. I then had to get time differences between each RESX file read operation and so I realized what files were taking longer to generate the resources.
I had RESX files that were taking about 200 seconds to process.
I still do not know why the RESX files from my projects now and then get this malformed references but one thing I know for sure: if I replace the version attribute to 18.104.22.168 the problem goes away and I get the normal compilation times for my solution.