Neil
Neil

Reputation: 5239

How to diagnose visual studio 2010 slow compile times after MVC4 update

I recently upgraded a solution to the latest release of ASP.NET MVC4 4.0.20710.0 which seems to have slowed down the build of the solution a lot.

Before it was taking ~twenty seconds for twenty projects and now that has increased to around two minutes.

So far I've tried

None of these have worked. My colleague is also experiencing this slowdown.

Has anyone else experienced this? Does anyone know of anything I can try to diagnose what in the build is slow?

Upvotes: 0

Views: 2318

Answers (2)

Paul Nicklin
Paul Nicklin

Reputation: 21

I too have a lot of projects 30+, and wanted to keep package restore for the CI builds, but NOT waste 2 minutes on my dev machine.

I replaced the nuget.targets in the Solution.nuget folder with an empty one.

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

</Project>

I don't check this in (obviously) and if I do need to do package restore I just put the proper one back.

Still need to disable it on the tools|options dialog, but you don't need to pick it out of the .proj files. as it will just "do nothing" when it tries to run the targets.

Hideous hack, but it works for me

Upvotes: 0

Neil
Neil

Reputation: 5239

Turns out someone had added Nuget package restore to the solution which was causing it to be painfully slow!

Credit for the fix goes to the following question for instructions on how to disable and remove it remove nuget package restore from solution

I fixed my solution with the following steps

  1. Remove ".nuget" folder from solution
  2. Delete .nuget folder from the file system and source control
  3. Using sublimetext2 run a search for "nuget" on the solution and all sub folders and remove all instances of the following line

<Import Project="$(SolutionDir)\.nuget\nuget.targets" />

After doing this my solution now builds in seconds again.

Upvotes: 1

Related Questions