Precompile Contradiction?

S

Scott M.

Scenario:

ASP .NET 2.0 Web "Site"
All but one page is written using inline VB .NET code.
One page is written using VB .NET code-behind.
MSBuild options are set at the default (allow pages to be updateable)

When I "publish" the site and take a look at the precompiled folder that is
generated by this process, I see a /bin folder has been created with one
file in it "App_Web_pccpykfu.dll".
I also see a new file: "PrecompiledApp.config" in the site root.
When I open up one of the .aspx files, I still see my VB .NET source code.
I did a little snooping in the MSDN help and found this:
(From:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vwdcon/html/c8048c31-012b-4718-b8ac-06a2dd41c137.htm)
"For precompiled sites that can be updated, the code in single-file pages is
not compiled into an assembly, but is instead deployed as source code."

So, here are my questions:

What is this "App_Web_pccpykfu.dll" file in my \bin folder?
What is the "PrecompiledApp.config" file in the site root?
Because I still see my source code in the inline .aspx files and because of
the snippet above I found in the help, does it mean that inline .aspx pages
set to be updateable will not actually be precompiled at all (since I don't
see any assemblies for the web pages - I was expecting one per page)?

Thanks,

Scott
 
S

Steven Cheng[MSFT]

Hello Scott,

In your message, you're asking some questions about the ASP.NET 2.0
precompilation model. I think we can clarify these questions by two steps:

1.Get how the ASP.NET 2.0 compile the pages at runtime(suppose you do not
precompile it)

2.What's the usage of different precompile model and what's the usage of
those generated procompile files and assemblies


1) So start from the 1st:

Suppose you do not perform precompilation, ASP.NET runtime will do the
following when you visit an aspx page the first time(leave both aspx and
codebehind source file unprecompiled):

** it first dynamically compile the codebehind file, and due to batch
compile model, it may compile a group of pages(and other referenced stuffs,
such as the one in App_code) together and generate assemblies.


**After the codegbehind class has been generated, a second class will be
generated, this class come from the aspx template and it derive from the
class generated from code behind.

** Finally, asp.net runtime will create the instance of the second class
for page instance.

Here is a web article which also introduce this page inheritance model:

#Understanding Page Inheritance in ASP.NET 2.0
http://west-wind.com/weblog/posts/3016.aspx



2)So for the VS 2005/ASP.NET 2.0's precompilation process(you do it through
VS 2005 or commandline tool), it has two models, "updatable" and
"nonupdatable"

**for "updatable", it only precompile the codebehind class into assembly
and still leave the aspx template so that you can change it after
precompilation(deploy). So at runtime, the second dynamic page class still
need to be generated on-demand dynamically

**for "nonupdatable", it will generate both the two dynamic generated
classes I mentioned above.

So now, have you got why there is also "xxx.dll" generated even you choose
"updatable" mode that do not precompile the aspx file?

In addition, for the "Precompile.config" file you mentioned, it is a xml
file, open it, you'll find those xml content actually indicate the
following information:

## [page url] aspx page's template and assembly has been precompiled into
[assembly name] assembly

Thus, at runtime, ASP.NET engine knows where it should locate the correct
page class/handler for a certain request path(since original aspx page may
have been precompiled and doesn't contains class/assembly info at all).

Hope this helps clarify the problem some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.






--------------------
 
S

Scott M.

Hi Steven,

A couple of thoughts on this...

So said:
**for "updatable", it only precompile the codebehind class into assembly
and still leave the aspx template so that you can change it after
precompilation(deploy). So at runtime, the second dynamic page class still
need to be generated on-demand dynamically

Then it would seem that Publish does NOT do a precomplie in this case
(because of the fact that the code that would need compliling is located in
the .aspx file that has been marked as being updateable). This was my
original assertion. - True?

I did surmize that the one assembly I did have that was found in my /bin
folder was for the one code-behind page in the site.

-Scott


Steven Cheng said:
Hello Scott,

In your message, you're asking some questions about the ASP.NET 2.0
precompilation model. I think we can clarify these questions by two steps:

1.Get how the ASP.NET 2.0 compile the pages at runtime(suppose you do not
precompile it)

2.What's the usage of different precompile model and what's the usage of
those generated procompile files and assemblies


1) So start from the 1st:

Suppose you do not perform precompilation, ASP.NET runtime will do the
following when you visit an aspx page the first time(leave both aspx and
codebehind source file unprecompiled):

** it first dynamically compile the codebehind file, and due to batch
compile model, it may compile a group of pages(and other referenced
stuffs,
such as the one in App_code) together and generate assemblies.


**After the codegbehind class has been generated, a second class will be
generated, this class come from the aspx template and it derive from the
class generated from code behind.

** Finally, asp.net runtime will create the instance of the second class
for page instance.

Here is a web article which also introduce this page inheritance model:

#Understanding Page Inheritance in ASP.NET 2.0
http://west-wind.com/weblog/posts/3016.aspx



2)So for the VS 2005/ASP.NET 2.0's precompilation process(you do it
through
VS 2005 or commandline tool), it has two models, "updatable" and
"nonupdatable"

**for "updatable", it only precompile the codebehind class into assembly
and still leave the aspx template so that you can change it after
precompilation(deploy). So at runtime, the second dynamic page class still
need to be generated on-demand dynamically

**for "nonupdatable", it will generate both the two dynamic generated
classes I mentioned above.

So now, have you got why there is also "xxx.dll" generated even you choose
"updatable" mode that do not precompile the aspx file?

In addition, for the "Precompile.config" file you mentioned, it is a xml
file, open it, you'll find those xml content actually indicate the
following information:

## [page url] aspx page's template and assembly has been precompiled into
[assembly name] assembly

Thus, at runtime, ASP.NET engine knows where it should locate the correct
page class/handler for a certain request path(since original aspx page may
have been precompiled and doesn't contains class/assembly info at all).

Hope this helps clarify the problem some.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no
rights.






--------------------
Reply-To: "Scott M." <[email protected]>
From: "Scott M." <[email protected]>
Subject: Precompile Contradiction?
Date: Wed, 21 Nov 2007 23:31:33 -0500
Scenario:

ASP .NET 2.0 Web "Site"
All but one page is written using inline VB .NET code.
One page is written using VB .NET code-behind.
MSBuild options are set at the default (allow pages to be updateable)

When I "publish" the site and take a look at the precompiled folder that is
generated by this process, I see a /bin folder has been created with one
file in it "App_Web_pccpykfu.dll".
I also see a new file: "PrecompiledApp.config" in the site root.
When I open up one of the .aspx files, I still see my VB .NET source code.
I did a little snooping in the MSDN help and found this:
(From:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_vwdcon/html/c80 48c31-012b-4718-b8ac-06a2dd41c137.htm)
"For precompiled sites that can be updated, the code in single-file pages is
not compiled into an assembly, but is instead deployed as source code."

So, here are my questions:

What is this "App_Web_pccpykfu.dll" file in my \bin folder?
What is the "PrecompiledApp.config" file in the site root?
Because I still see my source code in the inline .aspx files and because of
the snippet above I found in the help, does it mean that inline .aspx pages
set to be updateable will not actually be precompiled at all (since I don't
see any assemblies for the web pages - I was expecting one per page)?

Thanks,

Scott
 
S

Steven Cheng[MSFT]

Thanks for your reply Scott,

================
Then it would seem that Publish does NOT do a precomplie in this case
(because of the fact that the code that would need compliling is located in
the .aspx file that has been marked as being updateable). This was my
original assertion. - True?
=====================

Yes, when you select "updatable" precompile mode(publish site), for those
pages that do not use codebehind(separate code out of aspx file),
precompile won't generate page class(or assembly) for those particular
pages. Actually, you can do a simple test to verify this. If there is only
non-codebehind aspx pages in project and you publish it as "updatable", bin
dir will be empty(if no other stuffs such as App_Code codes will be
precompiled).

If you have any further questions on this, welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.

---------------
----
Reply-To: "Scott M." <[email protected]>
From: "Scott M." <[email protected]>
References: <[email protected]>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top