This isn't really a question on a problem; I've solved it my own (after banging my head against a wall for a couple of days) and I'd like to share it, but I'd be REALLY interested if someone can give me an explanation on why this happens.
The situation is simple enough : In C# 4.0, VS 2010 (haven't tested in other configs) create an empty ASP.NET web application
: File -> New -> Project (not Web Site) -> Web -> ASP.NET Empty Web Application.
In the newly created web app, create a page (add -> new item -> web form). Then run the project and, ofcourse, it works.
Now do the following :
- Clean the project output i.e. delete everything from the bin folder
- Change the project's output folder : project properties -> build -> output path. E.g. change bin\ to bin\debug (that's what I did)
BANG ! The project no longer works ! Try starting it (F5) and you get :
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'WebApplication2.WebForm1'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: /WebForm1.aspx Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237
If you don't do step #1 (delete everything from the bin folder) the project works but when you change the code inside WebForm1.aspx.cs you start getting "Source file not found" messages from the debugger. As I understand, for some %$&^#$^* reason, it still uses dlls from the bin folder.
It looks like the output folder is hard-coded somewhere... ?! Does anyone have any idea on why on earth does this happen ?????