ReSharper在添加Register指令时做了错误的事情

时间:2012-12-18 05:55:39

标签: c# asp.net resharper

ReSharper(7.1.25.234)在添加寄存器指令时做错了。

  1. 创建/Controls/ComplexField.ascx
  2. APageWithABunchOfFields.aspx中,请参阅新控件:

    <%@ Page Title="A page with a bunch of fields" Language="C#" MasterPageFile="~/Layouts/Site.Master" %>
    <myproj:ComplexField runat="server" />
    
  3. 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" />
    
  4. 问题是,找不到或执行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指令的理解有问题?

0 个答案:

没有答案