ReSharper(7.1.25.234)在添加寄存器指令时做错了。
/Controls/ComplexField.ascx
在APageWithABunchOfFields.aspx
中,请参阅新控件:
<%@ Page Title="A page with a bunch of fields" Language="C#" MasterPageFile="~/Layouts/Site.Master" %>
<myproj:ComplexField runat="server" />
ReSharper提供生成<%@ Register %>
指令,从而导致:
<%@ Page Title="A page with a bunch of fields" Language="C#" MasterPageFile="~/Layouts/Site.Master" %>
<%@ Register TagPrefix="myproj" Namespace="MyProject.Controls" Assembly="MyProject" %>
<myproj:ComplexField runat="server" />
问题是,找不到或执行ComplexField.ascx
(注意虽然ComplexField
实例确实被构造了)。 ReSharper 应生成的内容是:
<%@ Page Title="A page with a bunch of fields" Language="C#" MasterPageFile="~/Layouts/Site.Master" %>
<%@ Register TagPrefix="myproj" TagName="ComplexField" Src="~/Controls/ComplexField.ascx" %>
<myproj:ComplexField runat="server" />
换句话说,ReSharper正在通过命名空间而不是源路径来注册控件。 ReSharper导致的问题是ASP.NET在加载页面时不执行ComplexField.ascx
文件!
这是ReSharper中的错误/缺失功能还是我对Register指令的理解有问题?