获取无法在发布时加载类型错误

sam*_*sam 9 cruisecontrol.net msbuild aspnet-compiler

尝试使用aspnet_compiler发布后出现以下错误

errorASPPARSE: Circular file references are not allowed.
errorASPPARSE: Unknown server tag 'uc2:FAQ'.
errorASPPARSE: Could not load type 'CompoundControls.BBar'.
errorASPPARSE: Could not load type 'CompoundControls.PPIndicator'.
errorASPPARSE: Unknown server tag 'm:Calendar'.
errorASPPARSE: Could not load type 'SharedUserControls.VCDetails'.
errorASPPARSE: Could not load type 'SharedUserControls.VPDetails'.
errorASPPARSE: Could not load type 'SharedUserControls.VPrDetails'.
errorASPPARSE: Could not load type '.PopupPaymentCardCCVHelp'.     
Run Code Online (Sandbox Code Playgroud)

任何想法如何解决它们

Mrc*_*ief 1

出现Circular file references are not allowed错误的原因有多种。

如果不查看项目的结构或代码,很难查明确切的原因。

但是,如果我进行有根据的猜测,我会这样做:

  • 查看下一个错误:Unknown server tag 'uc2:FAQ'.,似乎无法编译该用户控件。
  • 这个用户控件也可能是这里的争论点。其余的都是没有编译的结果UserControl
  • 如果是这样,则检查用户控件中是否有对母版页/任何其他页面的引用(例如<%@ Reference Control="~/app.master" %>在 ascx 文件中)。

此外,当您不知不觉地陷入这种情况时(通过批处理),用户控件会发生不那么明显的循环引用问题

PageA.aspx -> uc1.ascx -> PageB.aspx (batching) -> uc1.ascx -> PageA.aspx (batching)

如果这是可能的原因,请尝试batch=false在您的配置中进行设置:

<configuration>
  <system.web>
    <!-- should prevent errorASPPARSE: Circular file references are not allowed -->
    <compilation batch="false" />
  </system.web>
</configuration>
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助。