我有一个引用这样的主题的 WebForm:
<%@ Page Title="Test" Language="C#" MasterPageFile="~/Test.master" AutoEventWireup="true"
CodeFile="Test.aspx.cs" Inherits="Test" Theme="TestTheme"%>
并且TestTheme仅包含一个Test.skin文件,其内容如下:
<asp:Button runat="server" CssClass="button" />
如果我执行该页面,我总是会收到如下编译错误消息:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code -1073741701.
仔细查看生成的 html 后,我发现了这个隐藏消息:
<!--
[HttpCompileException]: External component has thrown an exception.
at System.Web.Compilation.AssemblyBuilder.Compile()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(String themeName)
at System.Web.Compilation.ThemeDirectoryCompiler.GetThemeBuildResultType(HttpContext context, String themeName)
at System.Web.UI.Page.InitializeThemes()
at System.Web.UI.Page.PerformPreInit()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)...... and many more
但是,如果我删除主题引用,一切都会正常。
我猜编译App_Theme文件可能有问题,但不知道如何解决。
有什么想法吗?
最佳答案
我也遇到了同样的问题。看起来它发生在 Win 8.1 或 Win Server 2012 R2 上。 这就是我所做的:
- 卸载了 Visual Studio 2015
- 已卸载 .Net Framework 4.6
- 卸载了以下 Windows 更新(KB3074232、KB3098000、KB3098785、KB3074553、KB3083185、KB3097992、KB3097997)
- Windows 重新启动
之后,我按此顺序再次安装了更新(KB3097992、KB3097997)并且它起作用了。
关于ASP.NET WebForm App_Theme 导致编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32514606/