This applies to both 2008 and 2010 versions (and probably earlier ones too). Also to both C++ and C# projects.
An initial build (after reboot) runs at normal speed
If it's an ASP.NET MVC project, check the .csproj to see if <MvcBuildViews>true</MvcBuildViews>
is set. This can cause slow builds.
I had the same problem.
I had McAfee security center installed, by disabling the "Real time scan"
Building times did go from 40 seconds for a small project to 1 second.
Check your power saving settings in Windows. Set it to "High performance" (even on desktop). This helped for me.
My fix for very sluggish Visual Studio (building anything took about 1.5-2 min) was to turn off the wireless network.
I had enabled the Wireless Network in addition to the wired one. It seems like my computer tried to use the wireless connection to connect to our local server that is not available to wireless network and that caused the long delay.
Try to use ProcessMonitor (http://technet.microsoft.com/en-us/sysinternals/bb896645) to find what the Visual Studio doing during build process. Add the Filter "ProcessName is devenv.exe then Include" and make some research. It was useful for me.
I have a similar problem - very slow build and debug process - and I can solve it with Process Monitor. I run Process Monitor and saw that Visual Studio process read and write some HTL files many times. It was the Assembly Binding Log (http://msdn.microsoft.com/en-us/library/vstudio/e74a18c4(v=vs.100).aspx) - the utility that store information about libraries binding. Once I enabled this log, and this utility create about 8 Gb HTM logs on my hard drive ) It was very slow. Then i disable logging, the building time of my project decreases from 10 minutes to 10 seconds!
Since I came here via a Google search, I'll post what I found as the solution for my specific issue.
I had upgraded from .NET Core 1.1 to .NET Core 2.1. This caused the RazorGenerate and RazorTagHelper calls to take 20 seconds each. According to Daniel Crabtree, this was caused by a change in .NET Core 2.1 which enables pre-compiling of Razor views by default.
The fix is to add the following to your .csproj:
<PropertyGroup>
<UseRazorBuildServer>false</UseRazorBuildServer>
</PropertyGroup>
Source: https://www.danielcrabtree.com/blog/444/speed-up-compilation-of-asp-net-core-2-1-projects