Tip/Trick: Optimizing ASP.NET Build Time with Dynamic Compilation (optimizeCompilations=”true”)

If you are experiencing slow builds with ASP.NET projects or want to learn how to speed them up please read on.

Microsoft has introduced a new optimizeCompilations switch in ASP.NET that can greatly improve the compilation speed in some scenarios. You can read this blog post to understand the overall idea, study a more detailed explanation about Dynamic Compilation here or simply follow these 2 easy steps:

1) Install this hot-fix:

2) Update your web.config as follows:

Add optimizeCompilations=”true” to your <compilation …> tag. Below is an example:

<system.web>
....
<compilation debug="true" optimizeCompilations="true">
....
</compilation>
....
</system.web>

And you’re done! Next time you change something inside the App_code or even a dll inside the bin folder you might not have to wait the entire site to rebuild.

Important note: this approach speeds things up but you might get some weird errors when you start changing some code signatures or restructuring dlls.In this case, all you need to do is a simple “rebuild project/solution” inside your Visual Studio to get things straight again.

If you enjoyed this post, make sure you subscribe to my RSS feed!

About Wagner Danda

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!