06 July 2010

Speed up development of ASP.Net

ASP.Net by default compiles all the pages of the same folder and the bin on every call.
In a development environment this can slow down the tests of the code and sometimes the slow startup of the ASP.Net site is very annoying.
To try to improve this issue, there are two configuration options for the web.config or machine.config.

<system.web>
     <compilation batch="false" optimizeCompilations="true"></compilation>
</system.web>

To use the optimizeCompilations in any version of ASP.Net you have install a Microsoft patch located here.
The path is not needed for ASP.Net 4.0

Note: As side effect, the HTML changes may not take effect between compilations. In this case the Temporary ASP.NET Files folder for the site must be manually deleted.

Change Temporary ASP.NET Files location

To change the Temporary ASP.NET Files location, simply define the tempDirectory attribute of the compilation element of the web.config or machine.config.

Example:

<system.web>
   <compilation tempDirectory="d:\TempASPNetFiles\"></compilation>
</system.web>