<p>We are getting very slow compile times, which can take upwards of 20+ minutes on dual core   2GHz, 2G Ram machines.</p>

<p>A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an option unfortunately, so I don't want this to descend into a VSS bash)</p>

<p>We are looking at merging projects.  We are also looking at having multiple solutions to achieve greater separation of concerns and quicker compile times for each element of the application. This I can see will become a DLL hell as we try to keep things in synch.</p>

<p>I am interested to know how other teams have dealt with this scaling issue, what do you do when your code base reaches a critical mass that you are wasting half the day watching the status bar deliver compile messages.</p>

<p><strong>UPDATE</strong>
I neglected to mention this is a C# solution. Thanks for all the C++ suggestions, but it's been a few years since I've had to worry about headers.</p>

<p><strong>EDIT:</strong></p>

<p>Nice suggestions that have helped so far (not saying there aren't other nice suggestions below, just what has helped)</p>

<ul>
<li>New 3GHz laptop - the power of lost utilization works wonders when whinging to management
<li>Disable Anti Virus during compile
<li>'Disconnecting' from VSS (actually the network) during compile - I may get us to remove VS-VSS integration altogether and stick to using the VSS UI
</ul>

<p>Still not rip-snorting through a compile, but every bit helps.</p>

<p>Orion did mention in a comment that generics may have a play also. From my tests there does appear to be a minimal performance hit, but not high enough to sure - compile times can be inconsistent due to disc activity. Due to time limitations, my tests didn't include as many Generics, or as much code, as would appear in live system, so that may accumulate. I wouldn't avoid using generics where they are supposed to be used, just for compile time performance</p>

<p><strong>WORKAROUND</strong></p>

<p>We are testing the practice of building new areas of the application in new solutions, importing in the latest dlls as required, them integrating them into the larger solution when we are happy with them.</p>

<p>We may also do them same to existing code by creating temporary solutions that just encapsulate the areas we need to work on, and throwing them away after reintegrating the code. We need to weigh up the time it will take to reintegrate this code against the time we gain by not having Rip Van Winkle like experiences with rapid recompiling during development.</p>

[{'answer_id': 55522, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 4, 'selected': False, 'text': '<p>Use distributed compilation. Xoreax <a href="http://www.xoreax.com" rel="noreferrer">IncrediBuild</a> can cut compilation time down to few minutes.</p>\n\n<p>I\'ve used it on a huge C\\C++ solution which usually takes 5-6 hours to compile. IncrediBuild helped to reduce this time to 15 minutes.</p>\n'}, {'answer_id': 55524, 'author': 'Ed S.', 'author_id': 1053, 'author_profile': 'https://Stackoverflow.com/users/1053', 'pm_score': 3, 'selected': False, 'text': '<p>I posted this response originally here:\n<a href="https://stackoverflow.com/questions/8440/visual-studio-optimizations#8473">https://stackoverflow.com/questions/8440/visual-studio-optimizations#8473</a>\nYou can find many other helpful hints on that page.</p>\n\n<p>If you are using Visual Studio 2008, you can compile using the /MP flag to build a single project in parallel. I have read that this is also an undocumented feature in Visual Studio 2005, but have never tried myself.</p>\n\n<p>You can build multiple projects in parallel by using the /M flag, but this is usually already set to the number of available cores on the machine, though this only applies to VC++ I believe.</p>\n'}, {'answer_id': 55533, 'author': 'Adam Pierce', 'author_id': 5324, 'author_profile': 'https://Stackoverflow.com/users/5324', 'pm_score': 2, 'selected': False, 'text': '<p>Perhaps take some common functions and make some libraries, that way the same sources are not being compiled over and over again for multiple projects.</p>\n\n<p>If you are worried about different versions of DLLs getting mixed up, use static libraries.</p>\n'}, {'answer_id': 55541, 'author': 'Kristopher Johnson', 'author_id': 1175, 'author_profile': 'https://Stackoverflow.com/users/1175', 'pm_score': 3, 'selected': False, 'text': "<p>If this is C or C++, and you're not using precompiled headers, you should be.</p>\n"}, {'answer_id': 55542, 'author': 'Daniel Auger', 'author_id': 1644, 'author_profile': 'https://Stackoverflow.com/users/1644', 'pm_score': 1, 'selected': False, 'text': '<p>If this is a web app, setting batch build to true can help depending on the scenario.</p>\n\n<pre><code>&lt;compilation defaultLanguage="c#" debug="true" batch="true" &gt;  \n</code></pre>\n\n<p>You can find an overview here: <a href="http://weblogs.asp.net/bradleyb/archive/2005/12/06/432441.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/bradleyb/archive/2005/12/06/432441.aspx</a></p>\n'}, {'answer_id': 55585, 'author': 'Shog9', 'author_id': 811, 'author_profile': 'https://Stackoverflow.com/users/811', 'pm_score': 2, 'selected': False, 'text': '<p>Turn off VSS integration. You may not have a choice in using it, but DLLs get "accidentally" renamed all the time...</p>\n\n<p>And definitely check your pre-compiled header settings. Bruce Dawson\'s guide is a bit old, but still <em>very</em> good - check it out: <a href="http://www.cygnus-software.com/papers/precompiledheaders.html" rel="nofollow noreferrer">http://www.cygnus-software.com/papers/precompiledheaders.html</a></p>\n'}, {'answer_id': 55601, 'author': 'David L Morris', 'author_id': 3137, 'author_profile': 'https://Stackoverflow.com/users/3137', 'pm_score': 2, 'selected': False, 'text': '<p>I have a project which has 120 or more exes, libs and dlls and takes a considerable time to build. I use a tree of batch files that call make files from one master batch file.  I have had problems with odd things from incremental (or was it temperamental) headers in the past so I avoid them now.  I do a full build infrequently, and usually leave it to the end of the day while I go for a walk for an hour (so I can only guess it takes about half an hour).  So I understand why that is unworkable for working and testing.</p>\n\n<p>For working and testing I have another set of batch files for each app (or module or library) which also have all the debugging settings in place -- but these still call the same make files.  I may switch DEBUG on of off from time to time and also decide on builds or makes or if I want to also build libs that the module may depend on, and so on.</p>\n\n<p>The batch file also copies the completed result into the (or several) test folders.   Depending of the settings this completes in several seconds to a minute (as opposed to say half an hour).</p>\n\n<p>I used a different IDE (Zeus) as I like to have control over things like .rc files, and actually prefer to compile from the command line, even though I am using MS compliers.</p>\n\n<p>Happy to post an example of this batch file if anyone is interested.</p>\n'}, {'answer_id': 55625, 'author': 'Mark', 'author_id': 4405, 'author_profile': 'https://Stackoverflow.com/users/4405', 'pm_score': 1, 'selected': False, 'text': '<p>One cheaper alternative to Xoreax IB is the use of what I call uber-file builds.  It\'s basically a .cpp file that has</p>\n\n<pre><code>#include "file1.cpp"\n#include "file2.cpp"\n....\n#include "fileN.cpp"\n</code></pre>\n\n<p>Then you compile the uber units instead of the individual modules.  We\'ve seen compile times from from 10-15 minutes down to 1-2 minutes.  You might have to experiemnt with how many #includes per uber file make sense.  Depends on the projects. etc.  Maybe you include 10 files, maybe 20.</p>\n\n<p>You pay a cost so beware:</p>\n\n<ol>\n<li>You can\'t right click a file and say "compile..." as you have to exclude the individual cpp files from the build and include only the uber cpp files</li>\n<li>You have to be careful of static global variable conflicts. </li>\n<li>When you add new modules, you have to keep the uber files up to date</li>\n</ol>\n\n<p>It\'s kind of a pain, but for a project that is largely static in terms of new modules, the intial pain might be worth it.  I\'ve seen this method beat IB in some cases.</p>\n'}, {'answer_id': 55645, 'author': 'Nate', 'author_id': 4917, 'author_profile': 'https://Stackoverflow.com/users/4917', 'pm_score': 7, 'selected': True, 'text': '<p>The Chromium.org team listed several options for <a href="http://dev.chromium.org/developers/how-tos/build-instructions-windows" rel="noreferrer">accelerating the build</a> (at this point about half-way down the page):</p>\n\n<blockquote>\n  <p>In decreasing order of speedup:</p>\n  \n  <ul>\n  <li>Install Microsoft hotfix <a href="http://support.microsoft.com/kb/935225" rel="noreferrer">935225</a>.</li>\n  <li>Install Microsoft hotfix <a href="http://support.microsoft.com/kb/947315" rel="noreferrer">947315</a>. </li>\n  <li>Use a true multicore processor (ie. an Intel Core Duo 2; not a Pentium 4 HT).</li>\n  <li>Use 3 parallel builds. In Visual Studio 2005, you will find the option in <strong>Tools > Options... > Projects and Solutions > Build and Run > maximum number of parallel project builds</strong>.</li>\n  <li>Disable your anti-virus software for .ilk, .pdb, .cc, .h files and only check for viruses on <strong>modify</strong>. Disable scanning the directory where your sources reside. Don\'t do anything stupid.</li>\n  <li>Store and build the Chromium code on a second hard drive. It won\'t really speed up the build but at least your computer will stay responsive when you do gclient sync or a build.</li>\n  <li>Defragment your hard drive regularly.</li>\n  <li>Disable virtual memory.</li>\n  </ul>\n</blockquote>\n'}, {'answer_id': 55691, 'author': 'Bramha Ghosh', 'author_id': 3268, 'author_profile': 'https://Stackoverflow.com/users/3268', 'pm_score': 1, 'selected': False, 'text': '<p>You also may want to check for circular project references.  It was an issue for me once.</p>\n\n<p>That is:</p>\n\n<p>Project A references Project B</p>\n\n<p>Project B references Project C</p>\n\n<p>Project C references Project A</p>\n'}, {'answer_id': 57817, 'author': 'johnc', 'author_id': 5302, 'author_profile': 'https://Stackoverflow.com/users/5302', 'pm_score': 0, 'selected': False, 'text': "<p>Nice suggestions that have helped so far (not saying there aren't other nice suggestions below, if you are having issues, I recommend reading then, just what has helped us)</p>\n\n<ul>\n<li>New 3GHz laptop - the power of lost utilization works wonders when whinging to management\n\n<li>Disable Anti Virus during compile\n\n<li>'Disconnecting' from VSS (actually the network) during compile - I may get us to remove VS-VSS integration altogether and stick to using the VSS UI\n</ul>\n\n<p>Still not rip-snorting through a compile, but every bit helps.</p>\n\n<p>We are also testing the practice of building new areas of the application in new solutions, importing in the latest dlls as required, them integrating them into the larger solution when we are happy with them. </p>\n\n<p>We may also do them same to existing code by creating temporary solutions that just encapsulate the areas we need to work on, and throwing them away after reintegrating the code. We need to weigh up the time it will take to reintegrate this code against the time we gain by not having Rip Van Winkle like experiences with rapid recompiling during development.</p>\n\n<p>Orion did mention in a comment that generics may have a play also. From my tests there does appear to be a minimal performance hit, but not high enough to sure - compile times can be inconsistent due to disc activity. Due to time limitations, my tests didn't include as many Generics, or as much code, as would appear in live system, so that may accumulate. I wouldn't avoid using generics where they are supposed to be used, just for compile time performance</p>\n"}, {'answer_id': 57844, 'author': 'jdelator', 'author_id': 438, 'author_profile': 'https://Stackoverflow.com/users/438', 'pm_score': 4, 'selected': False, 'text': '<p>Turn off your antivirus. It adds ages to the compile time.</p>\n'}, {'answer_id': 274769, 'author': 'Hace', 'author_id': 18703, 'author_profile': 'https://Stackoverflow.com/users/18703', 'pm_score': 3, 'selected': False, 'text': '<p>We had a 80+ projects in our main solution which took around 4 to 6 minutes to build depending on what kind of machine a developer was working. We considered that to be way too long: for every single test it really eats away your FTEs.</p>\n\n<p>So how to get faster build times? As you seem to already know it is the number of projects that really hurt the buildtime. Of course we did not want to get rid of all our projects and simply throw all sourcefiles into one. But we had some projects that we could combine nevertheless: As every "Repository project" in the solution had its own unittest project, we simply combined all the unittest projects into one global-unittest project. That cut down the number of projects with about 12 projects and somehow saved 40% of the time to build the entire solution.</p>\n\n<p>We are thinking about another solution though.</p>\n\n<p>Have you also tried to setup a new (second) solution with a new project? This second solution should simply incorporates all files using solution folders. Because you might be surprised to see the build time of that new solution-with-just-one-project. </p>\n\n<p>However, working with two different solutions will take some carefull consideration. Developers might be inclined to actually -work- in the second solution and completely neglect the first. As the first solution with the 70+ projects will be the solution that takes care of your object-hierarchy, this should be the solution where your buildserver should run all your unittests. So the server for Continous Integration must be the first project/solution. You have to maintain your object-hierarchy, right. </p>\n\n<p>The second solution with just one project (which will build mucho faster) will than be the project where testing and debugging will be done by all developers. You have to take care of them looking at the buildserver though! If anything breaks it MUST be fixed.</p>\n'}, {'answer_id': 274778, 'author': 'GeekyMonkey', 'author_id': 29900, 'author_profile': 'https://Stackoverflow.com/users/29900', 'pm_score': 3, 'selected': False, 'text': '<p>Make sure your references are Project references, and not directly to the DLLs in the library output directories.</p>\n\n<p>Also, have these set to not copy locally except where absolutely necessary (The master EXE project).</p>\n'}, {'answer_id': 274780, 'author': 'GeekyMonkey', 'author_id': 29900, 'author_profile': 'https://Stackoverflow.com/users/29900', 'pm_score': 2, 'selected': False, 'text': '<p>Disable file system indexing on your source directories (specifically the obj directories if you want your source searchable)</p>\n'}, {'answer_id': 361618, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 5, 'selected': False, 'text': "<p>I had a similar issue on a solution with 21 projects and 1/2 million LOC. The biggest difference was getting faster hard drives. From the performance monitor the 'Avg. Disk Queue' would jump up significantly on the laptop indicating the hard drive was the bottle neck. </p>\n\n<p>Here's some data for total rebuild times...</p>\n\n<p>1) Laptop, Core 2 Duo 2GHz, 5400 RPM Drive (not sure of cache. Was standard Dell inspiron).</p>\n\n<p>Rebuild Time = 112 seconds.</p>\n\n<p>2) Desktop (standard issue), Core 2 Duo 2.3Ghz, single 7200RPM Drive 8MB Cache.</p>\n\n<p>Rebuild Time = 72 seconds.</p>\n\n<p>3) Desktop Core 2 Duo 3Ghz, single 10000 RPM WD Raptor</p>\n\n<p>Rebuild Time = 39 seconds.</p>\n\n<p>The 10,000 RPM drive can not be understated. Builds where significantly quicker plus everything else like displaying documentation, using file explorer was noticable quicker. It was a big productivity boost by speeding the code-build-run cycle.</p>\n\n<p><i>\nGiven what companies spend on developer salaries it is <em>insane</em> how much they can waste buy equiping them with the same PCs as the receptionist uses.\n</i></p>\n"}, {'answer_id': 701231, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': "<p>It's sure there's a problem with VS2008. Because the only thing I've done it's to install VS2008 for upgrading my project which has been created with VS2005.\nI've only got 2 projects in my solution. It isn't big.\nCompilation with VS2005 : 30 secondes\nCompilation with VS2008 : 5 minutes</p>\n"}, {'answer_id': 1608278, 'author': 'Chris O', 'author_id': 194709, 'author_profile': 'https://Stackoverflow.com/users/194709', 'pm_score': 1, 'selected': False, 'text': "<p>If it's a C++ project, then you should be using precompiled headers.  This makes a massive difference in compile times.  Not sure what cl.exe is really doing (with not using precompiled headers), it seems to be looking for <b>lots</b> of STL headers in all of the wrong places before finally going to the correct location.  This adds entire seconds to every single .cpp file being compiled.  Not sure if this is a cl.exe bug, or some sort of STL problem in VS2008.</p>\n"}, {'answer_id': 1826513, 'author': 'JBRWilkinson', 'author_id': 102345, 'author_profile': 'https://Stackoverflow.com/users/102345', 'pm_score': 1, 'selected': False, 'text': "<p>Looking at the machine that you're building on, is it optimally configured?</p>\n\n<p>We just got our build time for our largest C++ enterprise-scale product down from <strong>19 hours</strong> to <em>16 minutes</em> by ensuring the right SATA filter driver was installed. </p>\n\n<p>Subtle.</p>\n"}, {'answer_id': 2919582, 'author': 'Thomas K', 'author_id': 351738, 'author_profile': 'https://Stackoverflow.com/users/351738', 'pm_score': 3, 'selected': False, 'text': '<p>I notice this question is ages old, but the topic is still of interest today. The same problem bit me lately, and the two things that improved build performance the most were (1) use a dedicated (and fast) disk for compiling and (2) use the same outputfolder for all projects, and set CopyLocal to False on project references.</p>\n\n<p>Some additional resources:</p>\n\n<ul>\n<li><a href="https://stackoverflow.com/questions/8440/visual-studio-optimizations">https://stackoverflow.com/questions/8440/visual-studio-optimizations</a></li>\n<li><a href="http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/scottgu/archive/2007/11/01/tip-trick-hard-drive-speed-and-visual-studio-performance.aspx</a></li>\n<li><a href="http://arnosoftwaredev.blogspot.com/2010/05/how-to-improve-visual-studio-compile.html" rel="nofollow noreferrer">http://arnosoftwaredev.blogspot.com/2010/05/how-to-improve-visual-studio-compile.html</a></li>\n<li><a href="http://blog.brianhartsock.com/2009/12/22/analyzing-visual-studio-build-performance/" rel="nofollow noreferrer">http://blog.brianhartsock.com/2009/12/22/analyzing-visual-studio-build-performance/</a></li>\n</ul>\n'}, {'answer_id': 3558070, 'author': 'Pavel Radzivilovsky', 'author_id': 73656, 'author_profile': 'https://Stackoverflow.com/users/73656', 'pm_score': 1, 'selected': False, 'text': '<p>There\'s undocumented /MP switch in Visual Studio 2005, see <a href="http://lahsiv.net/blog/?p=40" rel="nofollow noreferrer">http://lahsiv.net/blog/?p=40</a>, which would enable parallel compilation on file basis rather than project basis. This may speed up compiling of the last project, or, if you compile one project.</p>\n'}, {'answer_id': 3558097, 'author': 'Pavel Radzivilovsky', 'author_id': 73656, 'author_profile': 'https://Stackoverflow.com/users/73656', 'pm_score': 3, 'selected': False, 'text': '<p>Some analysis tools:</p>\n\n<p>tools->options->VC++ project settings -> Build Timing = Yes\nwill tell you build time for every vcproj.</p>\n\n<p>Add <code>/Bt</code> switch to compiler command line to see how much every CPP file took</p>\n\n<p>Use <code>/showIncludes</code> to catch nested includes (header files that include other header files), and see what files could save a lot of IO by using forward declarations.</p>\n\n<p>This will help you optimize compiler performance by eliminating dependencies and performance hogs.</p>\n'}, {'answer_id': 3713370, 'author': 'Jonathan', 'author_id': 447845, 'author_profile': 'https://Stackoverflow.com/users/447845', 'pm_score': 3, 'selected': False, 'text': "<p>Before spending money to invest in faster hard drives, try building your project entirely on a RAM disk (assuming you have the RAM to spare).  You can find various free RAM disk drivers on the net.  You won't find any physical drive, including SSDs, that are faster than a RAM disk.</p>\n\n<p>In my case, a project that took 5 minutes to build on a 6-core i7 on a 7200 RPM SATA drive with Incredibuild was reduced by only about 15 seconds by using a RAM disk.  Considering the need to recopy to permanent storage and the potential for lost work, 15 seconds is not enough incentive to use a RAM disk and probably not much incentive to spend several hundreds of dollars on a high-RPM or SSD drive.</p>\n\n<p>The small gain may indicate that the build was CPU bound or that Windows file caching was rather effective, but since both tests were done from a state where the files weren't cached, I lean heavily towards CPU-bound compiles.  </p>\n\n<p>Depending on the actual code you're compiling your mileage may vary -- so don't hesitate to test.</p>\n"}, {'answer_id': 3726715, 'author': 'darklon', 'author_id': 214580, 'author_profile': 'https://Stackoverflow.com/users/214580', 'pm_score': 1, 'selected': False, 'text': "<p>When choosing a CPU: L1 cache size seems to have a huge impact on compilation time. Also, it is usually better to have 2 fast cores than 4 slow ones. Visual Studio doesn't use the extra cores very effectively. (I base this on my experience with the C++ compiler, but it is probably also true for the C# one.)</p>\n"}, {'answer_id': 3839912, 'author': 'haughtonomous', 'author_id': 463939, 'author_profile': 'https://Stackoverflow.com/users/463939', 'pm_score': 1, 'selected': False, 'text': "<p>I'm also now convinced there is a problem with VS2008. I'm running it on a dual core Intel laptop with 3G Ram, with anti-virus switched off. Compiling the solution is often quite slick, but if I have been debugging a subsequent recompile will often slow down to a crawl. It is clear from the continuous main disk light that there is a disk I/O bottleneck (you can hear it, too). If I cancel the build and shutdown VS the disk activity stops. Restart VS, reload the solution and then rebuild, and it is much faster. Unitl the next time</p>\n\n<p>My thoughts are that this is a memory paging issue - VS just runs out of memory and the O/S starts page swapping to try to make space but VS is demanding more than page swapping can deliver, so it slows down to a crawl. I can't think of any other explanation.</p>\n\n<p>VS definitely is not a RAD tool, is it?</p>\n"}, {'answer_id': 4648475, 'author': 'Weeble', 'author_id': 2283, 'author_profile': 'https://Stackoverflow.com/users/2283', 'pm_score': 2, 'selected': False, 'text': '<p>How big is your build directory after doing a complete build? If you stick with the default setup then every assembly that you build will copy all of the DLLs of its dependencies and its dependencies\' dependencies etc. to its bin directory. In my previous job when working with a solution of ~40 projects my colleagues discovered that by far the most expensive part of the build process was copying these assemblies over and over, and that one build could generate gigabytes of copies of the same DLLs over and over again.</p>\n\n<p>Here\'s some useful advice from Patrick Smacchia, author of NDepend, about what he believes should and shouldn\'t be separate assemblies:</p>\n\n<p><a href="http://codebetter.com/patricksmacchia/2008/12/08/advices-on-partitioning-code-through-net-assemblies/" rel="nofollow">http://codebetter.com/patricksmacchia/2008/12/08/advices-on-partitioning-code-through-net-assemblies/</a></p>\n\n<p>There are basically two ways you can work around this, and both have drawbacks. One is to reduce the number of assemblies, which is obviously a lot of work. Another is to restructure your build directories so that all your bin folders are consolidated and projects do not copy their dependencies\' DLLs - they don\'t need to because they are all in the same directory already. This dramatically reduces the number of files created and copied during a build, but it can be difficult to set up and can leave you with some difficulty pulling out only the DLLs required by a specific executable for packaging.</p>\n'}, {'answer_id': 5432452, 'author': 'Ian Ringrose', 'author_id': 57159, 'author_profile': 'https://Stackoverflow.com/users/57159', 'pm_score': 0, 'selected': False, 'text': '<p>There are a few things that I have found useful for speading up <strong>C# /.NET</strong> builds:</p>\n\n<ul>\n<li><p>Combine small projects into larger projects as there is a large per project overhead on building a solution.  (Use <strong>nDepend</strong> if needed to control calling across layers)</p></li>\n<li><p>Make all our projects build into the some output directory and then set “copy local” to false on all the project references – this can lead to a large speed up due to reduced IO.</p></li>\n<li><p>Turn of your virus checker to see if it makes much difference; if so find a <a href="https://stackoverflow.com/questions/1305709/slowdown-of-microsoft-visual-studio-due-to-different-virus-scanner">faster virus checker</a>, or exclude the "hot" folders from the virus checker scanning</p></li>\n<li><p>Use perforce monitor and the sys internal tool to see way your compiles are taking so long. </p></li>\n<li><p>Consider a ram disk to put your output directory on.</p></li>\n<li><p>Consider using a SSD</p></li>\n<li><p>More memory can have a big effect at times – (reduce  the ram in the machine if you get a big slow down by removing a little ram, you may get a big speed up by adding more)\nRemove unneeded project references (you may have to remove unneeded “usings” first)</p></li>\n<li><p>Consider using a dependency injection framework and interfaces for your lowest domain layer, so a recompile of everything is only needed when the interface changes – this may not gain much depending on how often the interface is changed.</p></li>\n</ul>\n'}, {'answer_id': 6131337, 'author': 'Sean', 'author_id': 770374, 'author_profile': 'https://Stackoverflow.com/users/770374', 'pm_score': 4, 'selected': False, 'text': "<p>Instructions for reducing your Visual Studio compile time to a few seconds</p>\n\n<p>Visual Studio is unfortunately not smart enough to distinguish an assembly's interface changes from inconsequential code body changes.  This fact, when combined with a large intertwined solutions, can sometimes create a perfect storm of unwanted 'full-builds' nearly every time you change a single line of code.</p>\n\n<p>A strategy to overcome this is to disable the automatic reference-tree builds.  To do this, use the 'Configuration Manager' (Build / Configuration Manager...then in the Active solution configuration dropdown, choose 'New') to create a new build configuration called 'ManualCompile' that copies from the Debug configuration, but do not check the 'Create new project configurations' checkbox.  In this new build configuration, uncheck every project so that none of them will build automatically.  Save this configuration by hitting 'Close'.  This new build configuration is added to your solution file.  </p>\n\n<p>You can switch from one build configuration to another via the build configuration dropdown at the top of your IDE screen (the one that usually shows either 'Debug' or 'Release').  Effectively this new ManualCompile build configuration will render useless the Build menu options for: 'Build Solution' or 'Rebuild Solution'.  Thus, when you are in the ManualCompile mode, you must manually build each project that you are modifying, which can be done by right-clicking on each affected project in the Solution Explorer, and then selecting 'Build' or 'Rebuild'.  You should see that your overall compile times will now be mere seconds.</p>\n\n<p>For this strategy to work, it is necessary for the VersionNumber found in the AssemblyInfo and GlobalAssemblyInfo files to remain static on the developer's machine (not during release builds of course), and that you don't sign your DLLs.</p>\n\n<p>A potential risk of using this ManualCompile strategy is that the developer might forget to compile required projects, and when they start the debugger, they get unexpected results (unable to attach debugger, files not found, etc.).  To avoid this, it is probably best to use the 'Debug' build configuration to compile a larger coding effort, and only use the ManualCompile build configuration during unit testing or for making quick changes that are of limited scope.</p>\n"}, {'answer_id': 6626597, 'author': 'Gone Coding', 'author_id': 201078, 'author_profile': 'https://Stackoverflow.com/users/201078', 'pm_score': 6, 'selected': False, 'text': "<h1>We have nearly 100 projects in one solution and a dev build time of only seconds :)</h1>\n\n<p>For local development builds we created a Visual Studio Addin that changes <code>Project references</code> to <code>DLL references</code> and unloads the unwanted projects (and an option to switch them back of course).</p>\n\n<ul>\n<li>Build our entire solution <em>once</em></li>\n<li>Unload the projects we are not currently working on and change all project references to DLL references.</li>\n<li>Before check-in change all references back from DLL to project references.</li>\n</ul>\n\n<p>Our builds now only take seconds when we are working on only a few projects at a time. We can also still debug the additional projects as it links to the debug DLLs. The tool typically takes 10-30 seconds to make a large number of changes, but you don't have to do it that often.</p>\n\n<h2>Update May 2015</h2>\n\n<p>The deal I made (in comments below), was that I would release the plugin to Open Source <em>if</em> it gets enough interest. 4 years later it has only 44 votes (and Visual Studio now has two subsequent versions), so it is currently a low-priority project.</p>\n"}, {'answer_id': 6934256, 'author': 'Luke Li', 'author_id': 877575, 'author_profile': 'https://Stackoverflow.com/users/877575', 'pm_score': 0, 'selected': False, 'text': '<p>I have found the following helps the compile speed: After repeated compiles (iterative development in memory), I would quit VS2008.  Then go into the project directories and delete all the <code>obj</code> and <code>bin</code> folders, start the project back up, and my compile time went way back down.  This is similar to the <code>Clean solution</code> action within VS2008.</p>\n\n<p>Just want to confirm if this is useful for anyone out there.</p>\n'}, {'answer_id': 7245705, 'author': 'Adi', 'author_id': 274589, 'author_profile': 'https://Stackoverflow.com/users/274589', 'pm_score': 0, 'selected': False, 'text': '<p>I found my fix here: <a href="http://blogs.msdn.com/b/vsdteam/archive/2006/09/15/756400.aspx" rel="nofollow">http://blogs.msdn.com/b/vsdteam/archive/2006/09/15/756400.aspx</a></p>\n'}, {'answer_id': 10554805, 'author': 'Alex Davies', 'author_id': 130921, 'author_profile': 'https://Stackoverflow.com/users/130921', 'pm_score': 4, 'selected': False, 'text': '<p>For C# .NET builds, you can use <a href="http://www.red-gate.com/products/dotnet-development/dotnet-demon/?utm_source=.NET%2bDemon&amp;utm_medium=stackoverflow&amp;utm_campaign=55517" rel="noreferrer">.NET Demon</a>. It\'s a product that takes over the Visual Studio build process to make it faster.</p>\n\n<p>It does this by analyzing the changes you made, and builds only the project you actually changed, as well as other projects that actually relied on the changes you made. That means if you only change internal code, only one project needs to build.</p>\n'}, {'answer_id': 16304078, 'author': 'Eric Aho', 'author_id': 2334171, 'author_profile': 'https://Stackoverflow.com/users/2334171', 'pm_score': 1, 'selected': False, 'text': '<p>Does your company happen to use Entrust for their PKI/Encryption solution by any chance?   It turns out, we were having abysmal build performance for a fairly large website built in C#, taking 7+ minutes on a Rebuild-All.  </p>\n\n<p>My machine is an i7-3770 with 16gb ram and a 512GB SSD, so performance should not have been that bad.  I noticed my build times were insanely faster on an older secondary machine building the same codebase. So I fired up ProcMon on both machines, profiled the builds, and compared the results.  </p>\n\n<p>Lo and behold, the slow-performing machine had one difference -- a reference to the Entrust.dll in the stacktrace.  Using this newly acquired info, I continued to search StackOverflow and found this: <a href="https://stackoverflow.com/questions/5298491/msbuild-vs2010-very-slow-on-some-machines">MSBUILD (VS2010) very slow on some machines</a>. According to the accepted answer the problem lies in the fact the Entrust handler was processing the .NET certificate checks instead of the native Microsoft handler. Tt is also suggested that Entrust v10 solves this issue that is prevalent in Entrust 9.</p>\n\n<p>I currently have it uninstalled and my build times plummeted to <em>24 seconds</em>. YYMV with the number of projects you currently are building and may not directly address the scaling issue you were inquiring about.  I will post an edit to this response if I can provide a fix <em>without</em> resorting to an uninstallation the software.</p>\n'}, {'answer_id': 26011118, 'author': 'Uzma Abidi - karachi', 'author_id': 4073501, 'author_profile': 'https://Stackoverflow.com/users/4073501', 'pm_score': -1, 'selected': False, 'text': '<p>Slow Visual Studio Performance … Solved!\nSeptember 24th, 2014 by Uzma Abidi</p>\n\n<p>I had an odd performance-related issue today. My Microsoft Visual Studio seemed to be taking far too long to perform even the simplest of operations. I Googled around and tried a few ideas that people had such as disabling add-ins or clearing Visual Studio’s recent projects list but those suggestions didn’t seem to solve the problem. I remembered that the Windows SysInternals website had a tool called Process Monitor that would sniff registry and file accesses by any running program. It seemed to me that Visual Studio was up to something and Process Monitor should help me figure out what it was. I downloaded the most recent version, and after fiddling around a bit with its display filters, ran it and to my horror, I saw that Visual Studio was so slow because it was accessing the more than 10,000 folders in C:\\Users\\krintoul\\AppData\\Local\\Microsoft\\WebSiteCache on most IDE operations. I’m not sure why there were that many folders and moreover, wasn’t sure what Visual Studio was doing with them, but after I zipped those folders up and moved them somewhere else, Visual Studio’s performance improved tremendously.</p>\n\n<p>The Windows SysInternals website has a number of other useful utilities for network management, security, system information and more. Check it out. I’m sure you’ll find something of value.</p>\n'}]
['https://Stackoverflow.com/questions/55517', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/5302/']