All in all, I must say that I am indeed a fan of the Web Application Projects (WAP) in VS 2005. If you're familiar with web development in the VS 2003/.NET 1.1 world, then this provides a much more comfortable and familiar experience than the Web Site Projects (WSP) in VS 2005 out of the box. I won't belabor the benefits of using them here as they have been covered extensively online.
I had created a WAP several months ago and came back to recently to update it and work on enhancing the functionality. By way of tendencies, I like to design such that each class is an internal class (that is, not publically exposed) with internal constructors, methods, properties, etc. As such, when I make a class public my intentions are clearer and the scope of the class is well defined. Well, such a model doesn't work too well with WSP due to the myriad of assemblies created. Today, however, in testing my application I was presented with an error message indicating that a class was “inaccessible due to its protection level”. This warning indicates to me that I'm trying to use a class out of its defined scope (in this case - internal).
As it turns out my .aspx code-behind IS in the same project as the internal class, but the WAP was exhibiting behaviors reminiscent of the WSP. In fact, the project would compile and I'd get .dlls generated in my \bin folder, but at runtime the .aspx pages were getting compiled into their own dlls.
The easy way to fix this (and I didn't know this wasn't here before) is to do the following:
- Right-click on the WAP in the solution explorer
- Select “Convert to Web Application”
That fixed up whatever was wrong with the project and now it works like a charm.