FIX: Visual Studio 2012 takes dramatically longer to build than Visual Studio 2010

Sunday, August 26, 2012

Symptoms

Aside from a very agitated developer, the solution or projects within the solution in question used Code Contracts in Visual Studio 2010 and the Code Contract library is not installed or working with Visual Studio 2012.  You can verify that this is the case by simply pulling up a project's properties.  If you have no code contract tab, you have no functioning add-on.  Go and install it. (As of this writing, you will have to run devenv /setup from a VS2012 Command Prompt to make it all work)

The Fix

Install the latest Code Contracts.  Reopen your solution.  Check the Code Contracts page and make sure they are configured optimally (cache enabled and background processing enabled).  It appears that even using identical settings to Visual Studio 2010, it still resulted in the compile taking far longer on Visual Studio 2012 with any code contracts enabled.  Perhaps the Code Contract's library just isn't ready for VS 2012 RTM.
Though Code Contracts are a great feature, I simply didn't need them for this project so I disabled them entirely and my build times went back to normal.  I'll follow up when I discover what the real cause was and am able to turn everything back on.

No comments :