R – Precompiling asp.net solutions for deployment

asp.netaspnet-compilervisual-studio-2008

I'm using aspnet_compiler.exe to precompile my application for deployment.

However, I don't think it's working, for two reasons:

  • I see my applications assemblies under C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files, even if i manually clear out this directory & restart the app.
  • The performance hit to JIT the application is present. This is very specifically what I'd like to avoid, even though it is 'one time'.

Here's specifically what I'm doing:

  1. Build the solution in studio.
  2. execute aspnet_compiler.exe -v /Foo -p c:\builddir c:\deploydir (where Foo is the vdir my app runs under, c:\builddir is where studio builds to, and c:\deploydir is the location where
  3. I then copy c:\deploydir to the web server.
  4. I access http://localhost/Foo
  5. After 30 seconds, the app displays, and I can see that assemblies have been generated in Temporary ASP.NET Files.

If it's notable, I'm using .net 3.5 SP1/Studio 2008 SP1. compilation debug=false is also set in web.config.

Best Answer

Your two points are moot:

  1. ASP.NET precompilation doesn't result in native image generation so JIT overhead will still be there. There might be a worker process creation overhead too.

  2. ASP.NET precompilation has the option to compile everything (incl. ASPX stuff, ...) or just source code (which you can specify with the -u switch). In case of the latter, those assemblies will still be generated for ASPX files. In case of the former, what you are seeing is not assembly generation. The runtime just copies and caches the assemblies in /bin in Temporary ASP.NET Files. You can confirm this fact by comparing the assemblies byte by byte and see that they are identical.