ASP.NET WebForm App_Theme导致编译错误

Luk*_*Fan 3 asp.net webforms

我有一个引用这样的主题的WebForm:

<%@ Page Title="Test" Language="C#" MasterPageFile="~/Test.master" AutoEventWireup="true"
CodeFile="Test.aspx.cs" Inherits="Test"  Theme="TestTheme"%>
Run Code Online (Sandbox Code Playgroud)

并且TestTheme只包含一个Test.skin文件,其中包含以下内容:

<asp:Button runat="server" CssClass="button" />
Run Code Online (Sandbox Code Playgroud)

如果我执行页面,我总是得到一个编译错误消息,如下所示:

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.
Run Code Online (Sandbox Code Playgroud)

仔细查看生成的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
Run Code Online (Sandbox Code Playgroud)

但是,如果我删除主题参考,一切正常.

我想编译App_Theme文件可能有问题,但根本不知道如何解决它.

有任何想法吗?

qrc*_*ak0 5

我遇到过同样的问题.它看起来好像发生在Win 8.1或Win Server 2012 R2上.这就是我所做的:

  • 卸载Visual Studio 2015
  • 卸载.Net框架4.6
  • 已卸载以下Windows更新(KB3074232,KB3098000,KB3098785,KB3074553,KB3083185,KB3097992,KB3097997)
  • Windows重启

之后,我按此顺序再次安装了更新(KB3097992,KB3097997)并且它有效.