gpt4 book ai didi

asp.net - 编译 ASP.NET 应用程序 - 网站与 Web 应用程序 - 具有指定 dll 名称的占位符 aspx 文件

转载 作者:行者123 更新时间:2023-12-04 05:07:25 24 4
gpt4 key购买 nike

一个 ASP.NET 应用程序是在 Visual Studio 之外开发的,它包含一个包含 ASP.NET 代码和 Visual Basic 代码的 aspx (pv.aspx) 文件。最初,我们使用 this 编译 aspx 文件。方法。这创建了一个 aspx“占位符”文件,从而隐藏了文件中包含的所有 ASP 以及 vb 代码。但是,不理想的部分是 .dll 文件的命名(例如:“pv.aspx.cdcab7d2.compiled”)。

然后我尝试在 VS2010 中创建一个网站项目,遵循 this有人在解释,但在这种情况下,VB 代码已正确编译,但 ASP.NET 代码未编译且仍然可见(即,不是使用 aspnet_compiler.exe 编译时的占位符文件)。

虽然这两个选项都有效并且应用程序在 IIS 中运行顺畅,但这并不是客户想要的。我被指示做以下事情:

  • 将 pv.aspx 编译为占位符文件,方法与命令行中的 aspnet_compiler.exe
  • 相同。
  • 将 dll 文件编译为具有特定名称,例如 pv.dll

  • 我在 StackOverflow 和其他网站上找到了可以做一件事或另一件事的信息,但不能两者兼而有之。甚至可能吗?如果没有,我如何设计这个 Web 应用程序,使 asp.net 代码和 vb 代码都看不到,但 dll 文件仍然具有指定的名称?

    最佳答案

    您想要的第一个选项(编译为占位符)是 ASP.NET compiler 的函数,特别是 -u未设置标志。来自编译器的文件名是内部生成的,并且在很大程度上是不可配置的。编译器公开的关于命名的唯一选项是-fixednames。 ,它将把每个页面和控件编译成一个自己的DLL文件;默认行为是在编译器认为合适时对它们进行批处理。您仍然无法控制命名。 (如果您使用 ASP.NET merge 工具,它可以将多个 DLL 合并为一个,您将可以控制 DLL 文件的名称。)
    带有不需要的名称的 .compiled 文件不是 DLL 文件,并且是在加载每个页面时定位正确的程序集和入口点所必需的。来自 File Handling During ASP.NET Precompilation :

    .compiled Files

    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.

    关于asp.net - 编译 ASP.NET 应用程序 - 网站与 Web 应用程序 - 具有指定 dll 名称的占位符 aspx 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15346881/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com