asp.net - 解析器错误 : Could not load type after changing output dir in asp. 网络应用程序

标签 asp.net visual-studio-2010 web-applications c#-4.0

这实际上不是关于问题的问题;我自己解决了这个问题(在我的头撞墙几天之后),我想分享它,但如果有人能给我解释为什么会这样,我真的很感兴趣。

情况很简单:在 C# 4.0 中,VS 2010(尚未在其他配置中测试)创建一个空的 ASP.NET web 应用程序

: File -> New -> Project (not Web Site) -> Web -> ASP.NET Empty Web Application.

在新创建的网络应用程序中,创建一个页面(添加 -> 新项目 -> 网络表单)。然后运行该项目,当然,它可以运行。

现在执行以下操作:

  1. 清理项目输出,即从 bin 文件夹中删除所有内容
  2. 更改项目的输出文件夹:项目属性 -> 构建 -> 输出路径。例如。将 bin\更改为 bin\debug(这就是我所做的)

砰!该项目不再有效!尝试启动它 (F5),你会得到:


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 

如果您执行第 1 步(从 bin 文件夹中删除所有内容),该项目可以运行,但是当您更改 WebForm1.aspx.cs 中的代码时,您开始从 debugger 获取“找不到源文件”消息。据我了解,由于某些 %$&^#$^* 原因,它仍然使用 bin 文件夹中的 dll。

看起来输出文件夹在某处被硬编码了...?!有谁知道为什么会发生这种情况?????

最佳答案

我知道为时已晚,但如果其他人正在寻找这个。 我有同样的问题,我发现项目中没有包含 bin 文件夹。在项目中包含 bin 文件夹,构建它应该没问题。

关于asp.net - 解析器错误 : Could not load type after changing output dir in asp. 网络应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8165668/

相关文章:

c# - 在 ASP.NET 的外部 C# 类中使用 Server.MapPath

javascript - 如何解决 DropDownList 更改时的 Javascript 未捕获引用错误?

c++ - 在实例方法中使用 find_if

Javascript单页应用导览工具

java - 应该为特定的 Web 应用程序选择什么框架?

asp.net - 无法获取asp.net中只读文本框的值

c# - 将 session 从 ASP.net 存储在 redis 服务器中,同时使用 Response.redirect 重定向到其他页面时抛出错误

c# - Visual Studio 2010 错误的 Crystal 报表

visual-studio-2010 - 更改默认字体 SSRS Visual Studio

javascript - 是否可以仅使用客户端语言构建 Web 应用程序?