我已将网站文件复制到一个新的 WAP 项目中。确保它编译并且确实如此。我遇到的问题是,当我执行到 WAP 的转换时,它无法解析 .aspx 页面。该错误只是说它无法解析 .aspx 页面。
当我查看 .aspx 页面之一时,我有页面指令,但它无法识别该命名空间。这是我用于我的新 WAP 项目的命名空间。
我的代码隐藏页面都具有命名空间 Instant.Web,并且项目属性设置为 Instant.Web 作为主要命名空间。
因此,例如,当我访问某个页面时,它无法识别我的 Inherits 的 Web.Attachment 部分。
这是一个例子(稍微修改了隐私的措辞):
SomeAspxPage.aspx :
<%@ Page Language="C#" Inherits="Instant.Web.Attachment" Codebehind="SomeAspxPage.aspx.cs" %>
<asp:Content ID="ctlContent" ContentPlaceHolderID="ctlContentPlaceHolder" runat="Server">
<Frm:Attachment ID="Attachment1" runat="server"/>
</asp:Content>
SomeaspxPage.aspx.cs
namespace Instant.Web
{
public partial class Attachment : Instant.InstantFrm.Pages.Base.UserPage
{
}
}
同样出于某种原因,代码隐藏中的 UserPage 没有显示为您可以右键单击并转到源的类。不知道为什么,因为该程序集肯定在这个 WAP 项目中,而且它是 Instant.InstantFrm 的最新程序集
最佳答案
Codebehind="Attachment.aspx.cs"
它查找文件 Attachment.aspx.cs,但该文件的名称是 SomeaspxPage.aspx.cs。通常“无法解析文件”表示向导找不到匹配的代码隐藏文件并且无法转换页面。 Before converting the project files, add references to the Web application project for assemblies that existed in the Bin folder to help prevent errors.
从您的描述中不清楚您是否已将引用添加到您的自定义用户页面。如果没有,并且该程序集只是复制到 WAP 项目的某个位置,它也会导致转换错误。
关于asp.net - 在 WAP 转换期间无法解析 .aspx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6798664/