JustBeingHelpful
JustBeingHelpful

Reputation: 18980

What parts of a .NET solution causes compilation to be slow?

My employer has a solution with 14 projects, and coincidentally, it takes precisely 14 seconds to compile the entire application. This makes it difficult to make changes and re-compile--lots of wasted time. What are things in a .NET application I can look for to make compilation quicker? Or may I ask, what tools are the best to troubleshoot this sort of thing. (To see what's happening with msbuild.exe)

Solution Details:

Please ask if you need more details.

Upvotes: 3

Views: 461

Answers (5)

MatthewMartin
MatthewMartin

Reputation: 33143

Compilation is sometimes disk bound, especially for .Net applications. It will go faster on a solid state drive. If you want to test this theory, put your code into RAM disk and compile it.

Upvotes: 2

bartosz.lipinski
bartosz.lipinski

Reputation: 2667

  • If your are using source control with local files e.g. SVN it is worth to disable anti-virus on your code directory.
  • Set Copy to Output Directory to Do not copy if you cannot do that use Copy if newer
  • If possible remove all pre/post build events
  • If you have WebSite project switch to WebApplication
  • For unloading and loading projects you could use Solution Load Manager.

Upvotes: 2

Igby Largeman
Igby Largeman

Reputation: 16747

To speed up building, unload the projects you're not working on. In the Solution Explorer, right click a project and click "Unload Project". You can select multiple projects and unload them all at once. When you build, unloaded projects will not be built.

If a solution contains a lot of projects, you're almost certainly only working on a few of them at any given time. If you're working on them all at once, you need to take a look at the way you work.

This is not the same as removing the project from the solution. When you need to change/rebuild an unloaded project, it's easily to simply reload it.

Upvotes: 2

Jason Miesionczek
Jason Miesionczek

Reputation: 14448

Do you need to rebuild the entire solution every time you make a change? Would rebuilding the current project be enough? that might speed things up a bit.

I work on a solution that has almost 300 separate projects, and takes about 2 minutes to do a full build, but when i am working i only build the project i am currently working on, saves a lot of time.

Upvotes: 3

SHug
SHug

Reputation: 688

When referencing other VS projects, ensure you have "copy local" set to false unless you require it for a specific reason.

You could create another solution specific to the projects that you are working on.

It's not a long time though!

Upvotes: 2

Related Questions