I accidentally opened up a web application project as a website. That’s not too hard to do. Just say you want to open a web site and point to the folder. It had been a while and I forgot that it was a WAP.
So I’m working on a web page and double click on a control and find myself in the markup with a new script tag and the .net code for the click event of the control. That wasn’t good considering I already had some nice event handlers for that control in my code behind.
I spent a lot of time going back and forth trying to figure out why I couldn’t get to my code behind.
I even remembered having this problem in the early days of Web App Project and the solution was to “convert to a Web Application Project” from the context menu in the solution explorer. But this option wasn’t available.
I created a new web site and looked at the page directive and noticed that in the new website the parameter pointing to the code behind file was called CodeFile, but in my old site it was CodeBehind. Wierd.
So with that clue I googled those two words, came across Steve Smith’s blog post about the opposite problem and realized my mistake!
Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!