Click here to Skip to main content
15,908,673 members
Please Sign up or sign in to vote.
4.88/5 (8 votes)
See more:
I maintain a build system for building C# solutions.
The code base is componentized by VS solution files and there are currently about 160 components in the code base.
The automated builds are run on a dedicated build server using CruiseControl and NAnt to build the entire code base each build.

One of the components consists of about 120 C# projects. On development machines and up until recently on the build server a complete rebuild of this solution took between 3 and 4 minutes.

About 2 weeks ago, between one build and the next, the compile time for this component jumped to 16 minutes. No other component exhibited a similar increase in build time.

We assumed this had something to do with intermediate files hanging around somewhere, so I deleted the entire AccuRev workspace and repopulated it on the build machine.
Build times for this component dropped back to around 3 minutes for 10 builds (over 4 days) and then jumped back to 16 minutes.
After a couple of days I repeated the workspace delete and repopulate and the build times dropped back to 3 minutes for 5 builds this time before jumping back to 16 minutes.

I have archived log files, freed up disk space and defragmented the hard drive.

I'm at a bit of a loss to explain why this is happening.
This only occurs on the build machine, developer builds take 3-4 minutes.

If anyone has any tips on what might be causing a dramatic increase in compile time for a C# solution like this, I'd appreciate hearing them.

thatraja 17-Jun-11 9:47am    
Good question, 5!
I'm also waiting for the answers
wizardzz 17-Jun-11 13:29pm    
yeah, I want to know, too.
Ciumac Sergiu 17-Jun-11 11:30am    
Good question indeed.
Sergey Alexandrovich Kryukov 17-Jun-11 14:21pm    
I would say: not enough information. Anything could happen.
Now, do you use anything except MSBuild and XML projects types? Do you have both incremental and from-scratch builds?
Peter Mulholland 20-Jun-11 5:02am    
No incremental builds, everything is "from scratch" or supposed to be.
We call MSbuild with the /t:Clean flag first before each build.
Component builds are ordered by dependency, so when a component is built, it's dependencies will have been built already, or it can build any that haven't been.
We have 1 over-night build for sandcastle documentation.
There's some fxcop, unit tests and coverage stuff done after each component builds, however I have timestamps outputting at the start and end of the MSBuild call and each of the NAnt targets that perform other functions in my build script.
The time increase is in the MSBuild call, which unfortunately doesn't output any intermediate times.

I have picked up a book recently on MSBuild, but I haven't had the time to do much investigation on customizing the MSBuild targets to try to get more info on where the time is increasing.

We did also add Post Sharp to the build recently, but I think it had been in the build a while before this issue popped up.

1 solution

Hi, Today I have found this article. I think this would be useful for you.

Speed up Visual Studio Builds[^]
Share this answer
Peter Mulholland 7-Nov-11 8:02am    
Thanks. I'd already tried the parallel builds flag (/m)with most of our MSBuild calls. I had to revert about half of them when they started failing to compile in parallel mode. That's probably something I should look into further. I'll have a look at the other suggestions in the article over lunch.
thatraja 7-Nov-11 8:18am    
Fine, BTW if you find any better solution then post it as a Tip/Trick here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900