0

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

  • Uninstalling all VS extensions
  • Restarting the editor
  • Restarting my machine
  • Running a repair on visual studio installation

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?

Neil
  • 5,179
  • 8
  • 48
  • 87
  • Twenty projects in a single solution!? That's where I would start. By reducing this number by externalizing them. – Darin Dimitrov Oct 04 '12 at 11:02
  • That's including the test projects so I could probably move them out. However it doesn't explain why the performance has taken such a drastic drop – Neil Oct 04 '12 at 11:07
  • Yeap it doesn't explain indeed. I haven't experienced such thing when I upgraded my projects to ASP.NET MVC 4. Of course there are far less projects in my solutions so it's incomparable. – Darin Dimitrov Oct 04 '12 at 11:08
  • I should say that it stalls in-between compiling the individual projects, like it's doing some pre or post build task, however there's no build tasks defined manually so I wonder whether it's doing something in the background – Neil Oct 04 '12 at 12:02
  • Looks like it's Nuget related, I uninstalled nuget from my computer and it slowed the build down even more. I'll post an answer if I manage to fix the problem – Neil Oct 04 '12 at 12:13

2 Answers2

1

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.

Community
  • 1
  • 1
Neil
  • 5,179
  • 8
  • 48
  • 87
0

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