c# - 如何从 bin 文件夹中删除 *.compiled 文件?

标签 c# asp.net asp.net-mvc razor asp.net-mvc-5

出于性能原因,我想使用预编译 View 部署我的网站。所以我配置了 UseMergePrecompileBeforePublish

这是我的发布配置文件的一部分:

<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>False</EnableUpdateable>
<UseMerge>True</UseMerge>
<SingleAssemblyName>Conwell.Administration.Views</SingleAssemblyName>
<DeleteAppCodeCompiledFiles>True</DeleteAppCodeCompiledFiles>

在 UI 中,这反射(reflect)了:

checkbox

我的 Conwell.Administration.Views.dll 已成功创建。但是在发布之后,我的 bin 文件夹中有一个额外的 .precompiled 文件:

*.compiled files

内容如下:

<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="2" virtualPath="/Areas/Bookings/Views/SepaDebits/Detail.cshtml" hash="fffffffff9d57aef" filehash="1737cd4f2d0e" flags="110000" assembly="Conwell.Administration.Views" type="ASP._Page_Areas_Bookings_Views_SepaDebits_Detail_cshtml">
  <filedeps>
    <filedep name="/Areas/Bookings/Views/SepaDebits/Detail.cshtml" />
  </filedeps>
</preserve>

我试图简单地删除它们,但网站只显示一个空白页面。我不喜欢那么多 *.compiled 文件。他们加起来超过一千。

它们的用途是什么?查看引擎?是否有可能以某种方式禁用它们?也许是自定义 ViewEngine?

我只找到了this thread到目前为止,但它没有给出任何指示。

最佳答案

For executable files in an ASP.NET Web application, the compiler assemblies and files with the .compiled file name extension. The assembly name is generated by the compiler. The .compiled file does not contain executable code. Instead, it contains only the information that ASP.NET needs to find the appropriate assembly.

After the precompiled application is deployed, ASP.NET uses the assemblies in the Bin folder to process requests. The precompilation output includes .aspx or .asmx files as placeholders for pages. The placeholder files contain no code. They exist only to provide a way to invoke ASP.NET for a specific page request and so that file permissions can be set to restrict access to the pages.

来源:https://msdn.microsoft.com/en-us/library/e22s60h9(v=vs.85).aspx

您必须删除预编译步骤才能删除它们,或者单独部署源代码。使用构建服务器进行实时编译。

我会离开他们。它们不会造成伤害。

关于c# - 如何从 bin 文件夹中删除 *.compiled 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46325148/

相关文章:

c# - MVC 路由去掉 URL 中的/Index

.net - 如何使用 SignalR 将事件从 Web Api 项目广播到不同应用程序池上的 MVC 应用程序

javascript - 在 HTML 中注入(inject) Javascript 片段

c# - 在不懂 C 的情况下开始学习 C#?

c# - 我可以通过 Windows 窗体弹出帮助 "speech bubble"吗?

c# - 如何像 JSON.stringify() 那样在 C# 中对 json 进行字符串化/规范化

c# - ASP.NET:登录时更改 div 内容

javascript - 服务器端的动态按钮/动态按钮容器

c# - SortedSet<T> 需要使用不同的排序和相等标准

c# - 如何使用c#从dataTable实现Count(Distinct {x})?