By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

Precompiling ASPX/ASCX for discovering compile-time errors...

P: n/a
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
I am not sure I understand you. Even precompile will not catch typos in the
controls when you are talking about the UI of the page (ie, the tags in the
ASPX). Not having full intellisense is certainly one of the issues; which I
believe can be conquered, if it is worth the time.

There are other options, however.

1. Create a server control instead, which allows you to use the property
sheet
2. Add reference in your code behind to the control. Then, you can
programatically set the property using Intellisense

You can use a product like NAnt (Source Forge open source project), but
precompile will still not catch tag typos.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Holger (David) Wagner" <da***@purple-sunshine.de> wrote in message
news:cf**********@svr7.m-online.net...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #2

P: n/a
Start putting all your server side code in a codebehind file. That way you
compile that code and see errors right away. And if you're using vs.net for
development, you also get the benefits of intellisense, etc.

"Holger (David) Wagner" <da***@purple-sunshine.de> wrote in message
news:cf**********@svr7.m-online.net...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #3

P: n/a
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...

"Holger (David) Wagner" <da***@purple-sunshine.de> ???
news:cf**********@svr7.m-online.net ???...
Hi Group,

I've searched the Web for precompilers that compile ASPX/ASCX pages just
like it can be done with JSPs, but so far, I've only found approaches
targetted at increasing the performance. What I'd like to do this for,
however, is discovering compile-time errors during my normal build.

Currently, just a typo in a Property name goes unnoticed until the page
is hit the first time which is not particularly satisfying (this is like
opening an application and actually using/testing it to find syntax
errors)... is there any option in MS VS.NET 2003 to activate such a type
of (pre-)compilation?

I know this is included in Whidbey, but we can't use this, yet...

kind regards,
david

Nov 18 '05 #4

P: n/a
Marina wrote:
Start putting all your server side code in a codebehind file. That way you
compile that code and see errors right away. And if you're using vs.net for
development, you also get the benefits of intellisense, etc.


One option, of course, would be using labels etc. and setting their
values from the code behind file. This is how I did it when I started
with ASPX, but this turned out to be rather cumbersome when not using
the designer (which I don't use because it keeps on destroying my HTML
code, hope whidbey will solve this)...

With labels, databinding would also work - but this is also totally not
"compile-safe" (typo in the databinding expression, and your gone...)
What I'm doing right now is using properties in the code-behind file,
which I use in the ascx/aspx-controls. This looks something like this:

<TABLE border="0" cellspacing="0" cellpadding="4">
<TR>
<TD><%= Name %> someText <%= SomeCountX %></TD>
</TR>
</TABLE>

This is much more readable than putting labels in there for Name and
AuditoriumCount, and using labels doesn't even get me any further
concerning the "compile-time security": when I change the IDs of the
labels in the ascx/aspx-file, they may not be automatically be changed
in the codebehind file which will get me NullReferenceExceptions at
runtime (I don't use the designer at all anymore, as it always destroys
my HTML-code).

However, this blows up my codebehind file significantly, and still when
there's a typo in the ascx/aspx-file, I get something like this:

===== START included error message ====

Server Error in '/' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.

Compiler Error Message: CS0103: The name 'SomeCountX' does not exist in
the class or namespace 'ASP.DetailsPage_ascx'

Source Error:
Line 11: <TABLE border="0" cellspacing="0" cellpadding="4">
Line 12: <TR>
Line 13: <TD><%= Name %> someText <%= SomeCountX %></TD>
Line 14: </TR>
Line 15: </TABLE>
Source File: http://localhost/UI/PageContents/DetailsPage.ascx Line: 13

===== END included error message ====

So, this does help me a little bit (misspelling a property is not such a
simple mistake), but blows up my codebehind files significantly. E.g.
when I use a typed dataset (with a couple of columns), I have to repeat
each property of the dataset in my codebehind file - it would be much
more elegant putting this directly into the page (e.g.
dsMyDataSet.MY_TYPED_COLUMN) than having a lot of getters for this, like

public string MyTypedColumnValue {
get { return dsMyDataSet.MY_TYPED_COLUMN; }
}

kind regards,
david
Nov 18 '05 #5

P: n/a
Cowboy (Gregory A. Beamer) [MVP] wrote:
I am not sure I understand you. Even precompile will not catch typos in the
controls when you are talking about the UI of the page (ie, the tags in the
ASPX). Not having full intellisense is certainly one of the issues; which I
believe can be conquered, if it is worth the time.

There are other options, however.

1. Create a server control instead, which allows you to use the property
sheet
I avoid the designer whenever I can as it destroys the HTML code... at
first, I used the designer all the time, with a lot of WebControls... by
now, I've converted to using <%# ... %> and <%= ... %> whenever I can.

When Whidbey stops messing with the HTML code, I might convert back
again, but right now I have switched the design view off...
2. Add reference in your code behind to the control. Then, you can
programatically set the property using Intellisense

You can use a product like NAnt (Source Forge open source project), but
precompile will still not catch tag typos.


I'm not concerned with tag typos... actually, I think VS.NET issues
warnings when the HTML-code is incorrect. Does NAnt support compiling
aspx-pages? And ascx-controls? That would be just what I need...

kind regards,
david
Nov 18 '05 #6

P: n/a
Lau Lei Cheong wrote:
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...


Is there a setting for this somewhere? I'm talking about using
properties of the codebehind-class in the ASCX/ASPX-page, which my
VS.NET (2003) never notices...

kind regards,
david
Nov 18 '05 #7

P: n/a
Hi David:

Unfortunately no, not until VS.NET 2005.

--
Scott
http://www.OdeToCode.com

On Tue, 17 Aug 2004 20:24:43 +0200, "Holger (David) Wagner"
<da***@purple-sunshine.de> wrote:
Lau Lei Cheong wrote:
It's a bit strange, but typo errors in property name must be shown when you
"Build" your project.("Build" -> "Build solution") You can even press "F5"
to run you project for checking runtime error...


Is there a setting for this somewhere? I'm talking about using
properties of the codebehind-class in the ASCX/ASPX-page, which my
VS.NET (2003) never notices...

kind regards,
david


Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.