Rick Strahl's Weblog  

Wind, waves, code and everything in between...
.NET • C# • Markdown • WPF • All Things Web
Contact   •   Articles   •   Products   •   Support   •   Advertise
Sponsored by:
Markdown Monster - The Markdown Editor for Windows

VS 2005 not compiling ASPX Code Beside files weirdness


:P
On this page:

Hmmm… I just ran into the strangest thing in VS 2005 with an ASP.NET project. For some reason compiling the project inside of Visual Studio will not find any errors in ASPX code beside files. A Rebuild All results in no errors, but running various pages results in runtime errors which I can fix and see fixed in the runtime files – so I'm not completely off my rocker (I think) in that I am working on the right code…

 

The compiler does find errors in any App_Code files, just not in ASPX or ASP.cs files. Very bizarre.

 

Anybody have any clue what could be causing this? It's just this one project – it's demo project that contains the ATLAS runtimes and web.config settings along with a bunch of other samples.

 


The Voices of Reason


 

scottgu
March 22, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

What errors are you seeing? Are they compile errors or runtime errors?

Rick Strahl
March 22, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Compiler errors. I can go into a .cs code behind file and type some garbage into the document then Build. No Errors - full rebuild says Rebuild All Successfull. Then run the same page and it flags the error correctly.

The only time I've seen something similar is something related to web.config, where ASP.NET just stops compiling because some setting isn't set right.

I've mucked around in web.config a bit and now the problem has gone away, but I can't tell what was the original cause. If something was actually wrong in web.config i'd expect the project to not run at all. <shrug>

Christoph Richter
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Hi,
in the Properties of the webProject at "Build"
there are the options to:

"Build web site as part of the solution"
if you uncheck that, the website isnt build when the solution gets build (you see that also in the build log)

"Before running startup page:"
boosts the startup of f5 debugging because of skipping the compilation, e.g. only compile that things that you access.

if you make an recompile only from the web project this should alwways return all errors.

the problem seems to be, that the cs in the app_code gets compiled in one assembly, but the stuff in the aspx files gets compiled by access. so if you make an explicit compile, it just makes it for verification, but not for runtime usage.

btw: if you choose publish, it must compile the stuff, since we dont want to have cs files on the live servers....

come thru all that stuff while speeding up my Build time. gone from about 3-5 mins to some secs... (needed a small programm that does some stuff i turned off, but its much better so, than waiting for godot every time...)

Jeff
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Hi,

have you tried setting batch=false in the compilation element of your web.config. I've run into this before this seems to have solved it - usually happens in conversions of vs2k3 to vs2k5 projects

rich
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

I don't know about your problem but here is another absolute bitch I have only experienced in VS 2005.

If you are developing a VB.NET Winforms app, when from time to time, you click to save the form file, it first deletes the file, and then it will frequently give you an 'access denied' and not save it. You can then click and save again. However, I just got thrown out of VS2005 with a fatal error, between getting the 'access denied' message and before I could re-save. Result: 2 hours work down the toilet.

I am sick and tired of reading all the Microsofties' blogs boasting and bragging about how unbelievably clever and hip they are. We are talking about the descendant of VB1 here, which has had 14 years and billions of dollars development thrown into it. And yet these geniuses have managed to break such a simple and straightforward - yet vital - function, which worked correctly in all prior versions.

And while I'm in rant mode, what about the changes to ASP.NET between VS 2003 and 2005. We have about fifteen ASP.NET apps and not one will build in 2005 without work. So to migrate from one version of the development system to the next we need to revisit (and re-test) fifteen working, in-production applications, for no good reason that I can see.

And yet ten years back I could take a well-written 16-bit C++/MFC app and get it to work with virtually no changes in 32 bit (changing architecture you would think being a considerably bigger change than going from VS2003->VS2005).




Steve from Pleasant Hill
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Every time I build up the courage to migrate to VS 2005 you guys ruin my day.

For straight Win32 development I will stay with Delphi rather than do .NET Winforms. I want to use .NET 2 (and was almost there due to so many helpful posts on this site) but now I'm freakin' out man....

Rich, I hear you -- did completely different teams write VS 2003 and 2005?

rich
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Steve from PH: Joel Spolsky has an interesting take on it in "The Two Forces at Microsoft" here: http://www.joelonsoftware.com/articles/APIWar.html

I think what we are seeing may be an effect of the way software development has changed over the years. Back when I started in the 80s, development was a specialised task, chiefly the province of well-paid engineer types, supported by similar types at MS and other places (like Raymond Chen). You couldn't get away with selling a pile of crap to an engineer.

Now everyone and his brother is doing development. Upward compatibility used to be vital because an engineer's time was expensive. Now why spend an extra six months ensuring upward compatibility in your product if your perception is that your customer can simply throw a couple of hundred more Indians at the problem instead?

rich
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Steve From PH (Continued):
Similarly, the way software development is now increasingly being carried out by large global teams working for the mega international consultancies has changed the game. In the past, software houses and individual developers demanded high standards from MS and others, as their bottom line depended on things working right and there was no room for error.

But global consultancy firms are all about billing hundreds of bodies at time and materials for as long as possible. The management they employ is primarily concerned with relationship management, current buzzwords and looking good in front of the influencer of the day, not engineering a good product. Engineers in these firms are at best marginalized and at worst about as welcome as the proverbial turd in a swimming pool. I'd be surprised if more than 10% of the projects the Accentures, CSCs and Logicas of the world work on ever go live. If they do, the client likely goes in a different direction and dumps it within a few months anyway. So what do they care if in the middle of a project they have to take a time out because a development system upgrade has broken things?


Steve from Pleasant Hill
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Rich: you are confirming my own dark thoughts that I try to suppress.

Time to open my juice bar and do software for fun again.


rich
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

I content myself with the thought that before the advent of the ubiquitous megaproject so well satirised here: http://www.thedailywtf.com/forums/64597/ShowPost.aspx and here http://www.thedailywtf.com/forums/64833/ShowPost.aspx ...

that there were clients who required cost-effective, well-engineered solutions which helped them write business, and that they will continue to exist.

soccerdad
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

When I've run into flakiness like this, I delete the temporary asp.net directories/files under the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files directory.

Rick Strahl
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Thanks for all the comments! The problem here was specifically one file that had an error in it and for some reason VS didn't show the error. Once fixed all worked again.

BTW, I've used Christophs suggestion for simply removing Web Projects from the full build step so you have to manually compile projects on a coupleof larger projects. Especially when I'm working primarily on business logic. In those situations it's better to compile just a page (also an option on the .cs codebehind) or compile the Web project explicitly.

Definitely can save a lot of time.

As I mentioned before for me the better choice seems to be Web Application Projects which works like VS2003 in terms of compilation. For all those that want the 'real' project model back that's the way to go, but you also loose some of the nice features of the pure file model like the ability to simply change a page and keep running without a recompile even in debug mode.

http://msdn.microsoft.com/asp.net/reference/infrastructure/wap/

Anatoly Lubarsky
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Rick: You can still use WAP with the ability to change the page if you change "codefile" attribute instead of "codebehind" in the page declaration.

Rick Strahl
March 23, 2006

# re: VS 2005 not compiling ASPX Code Beside files weirdness

Anatoly, great tip!

Hmmm... but won't that break the cs.designer file connection? You'd have to switch back and forth.

I have to try that out.

# DotNetSlackers: VS 2005 not compiling ASPX Code Beside files weirdness


Soyokaze
June 10, 2009

# re: VS 2005 not compiling ASPX Code Beside files weirdness

I had the same issue of errors in codebehind not being thrown during compile time, and I managed to fix this by going into my solution properties and check the 'build' checkbox under 'Configuration Properties > Configuration', where I noticed my web site was / had become unchecked. After checking the box and clicking Ok the codebehind errors are shown once again when I build my solution.

West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2024