代码之家  ›  专栏  ›  技术社区  ›  EKS

分析器错误消息:文件“/TestSite/Default.aspx”不存在

  •  33
  • EKS  · 技术社区  · 17 年前

    短篇故事。

    分析器错误消息:文件“/TestSite/Default.aspx”不存在。

    源错误:

    <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="GuildStats._Default" %>

    第2行:

    <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">

    默认值s.aspx.cs

    namespace GuildStats
    {
        public partial class _Default : System.Web.UI.Page
        {
    

    默认值.aspx

    <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="GuildStats._Default" %>
    

    Site.master.cs

    namespace GuildStats
    {
        public partial class Site : System.Web.UI.MasterPage { }
    }
    

    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs" Inherits="GuildStats.Site" %>
    
    2 回复  |  直到 12 年前
        1
  •  87
  •   abatishchev Karl Johan    12 年前

    在……里面 Default.aspx 改变 CodeFile CodeBehind 。你可能也必须为 Site.master .

    请参阅: CodeFile and Code-Behind

        2
  •  15
  •   Kiki    14 年前

    网站项目使用CodeFile,Web应用程序项目使用CodeBehind。 CodeFile需要源文件,它是在加载页面时动态编译的,CodeBehind需要编译后的代码。

    我的猜测是,当你将项目类型从WebApp更改为网站,反之亦然时,你的问题就产生了。如果你这样做,你必须手动更改现有文件中的指令,新文件将自动具有正确的指令。