What is the advantage of the ASP.NET precompilation?
Asked Answered
K

3

5

How useful is it to use Aspnet_compiler.exe instead of conventional Publish via Visual Studio? And what about resource (resx) files?

Kanazawa answered 8/1, 2010 at 12:57 Comment(0)
U
6

Precompilation, as opposed to simple xcopy gives you two main advantages:

  1. The filesystem will not have all the code in .aspx files and all the code behind is compiled into an assembly.

  2. There is no ASP.NET compilation delay the first time you visit a page after the server starts up.

Having said that, my precompilation knowledge is a bit rusty these days, last time I touched it was a while back.

Ulberto answered 8/1, 2010 at 13:4 Comment(2)
When you say no code in .aspx files, you mean any inline code in render tags are removed?Klee
From memory the aspx file becomes just an empty placeholder - no markup and no code. Everything is compiled into an assembly.Ulberto
W
3

By pre compiling the site your server won't have to compile the site on the first visit. You have probably noticed that the first time you view an asp.net page there is a noticeable delay.

In addition you don't have to ship all your files since the code is already compiled. This can be useful if you don't trust whoever is hosting your pages.

Worsham answered 8/1, 2010 at 13:2 Comment(0)
C
0

Visual Studio's "Publish" feature is actually just a nice frontend to aspnet_compiler.exe. Publish has the advantage of being very easy to execute, where aspnet_compiler.exe requires some tweaking to get the results you're after.

Cembalo answered 8/1, 2010 at 13:7 Comment(2)
aspnet_compiler.exe seems to also compile the resource files. The resx files are compiled to dll.Kanazawa
It's all about the arguments passed to aspnet_compiler. Unfortunately, Visual Studio doesn't make those calls public.Cembalo

© 2022 - 2024 — McMap. All rights reserved.