未使用 ScriptResourceDefinition 路径
ScriptResourceDefinition Path not Used
我一直在关注 Cecil Phillip 的 Setting up Webpack in ASP.NET Web Forms to get familiar with the Webpack utility. I have gotten most of the way through it, but am having trouble with a section near the end (Registering with the ScriptManager)。
我添加了一个 ScriptResourceDefinition
,其中 Path
和 DebugPath
分别设置为 Webpack 输出的缩小版和未缩小版。当我在调试版本中加载页面时,我得到了预期的 DebugPath
脚本。但是,当我在发布版本中加载它时,而不是预期的 Path
脚本,我再次得到 DebugPath
。知道为什么会这样,以及如何获得正确的 Path
?
找到了。原来我对 ScriptManager
的工作原理做了一些错误的假设。这是我的思路 --
研究过ScriptResourceDefinition.DebugPath:
Gets or sets the debug mode path of the script resource that is used when debug mode is enabled.
查找了底部引用的 "See Also" link 到 Debugging and Tracing ASP.NET AJAX Applications Overview:
When you deploy a release version of an WebForms application that uses Microsoft Ajax,
set the application to release mode. This makes sure that ASP.NET uses
the performance-optimized release version of the Microsoft Ajax
libraries. If you have created debug and release versions of your
custom script files and script resources, ASP.NET also uses the
release versions. To set the application to release mode, do the
following:
In the Web.config file, if the compilation element contains a debug
attribute, make sure that the debug attribute is set to false.
Make sure that any Web page that contains a ScriptManager control has
its ScriptMode property set to Release.
进一步研究 ScriptManager.ScriptMode:
The ScriptMode property specifies whether the ScriptManager control should render debug or release versions of client script libraries. This value can be superseded by values that are set in the configuration file and in the page directive.
...
[By default] Debug versions of client script libraries are used in the Web page when the retail attribute of the deployment configuration element is set to false. Otherwise, the release versions of client script libraries are used.
为了对此进行测试,我尝试将 ScriptMode
设置为 Release
并加载了正确的文件。
我一直在关注 Cecil Phillip 的 Setting up Webpack in ASP.NET Web Forms to get familiar with the Webpack utility. I have gotten most of the way through it, but am having trouble with a section near the end (Registering with the ScriptManager)。
我添加了一个 ScriptResourceDefinition
,其中 Path
和 DebugPath
分别设置为 Webpack 输出的缩小版和未缩小版。当我在调试版本中加载页面时,我得到了预期的 DebugPath
脚本。但是,当我在发布版本中加载它时,而不是预期的 Path
脚本,我再次得到 DebugPath
。知道为什么会这样,以及如何获得正确的 Path
?
找到了。原来我对 ScriptManager
的工作原理做了一些错误的假设。这是我的思路 --
研究过ScriptResourceDefinition.DebugPath:
Gets or sets the debug mode path of the script resource that is used when debug mode is enabled.
查找了底部引用的 "See Also" link 到 Debugging and Tracing ASP.NET AJAX Applications Overview:
When you deploy a release version of an WebForms application that uses Microsoft Ajax, set the application to release mode. This makes sure that ASP.NET uses the performance-optimized release version of the Microsoft Ajax libraries. If you have created debug and release versions of your custom script files and script resources, ASP.NET also uses the release versions. To set the application to release mode, do the following:
In the Web.config file, if the compilation element contains a debug attribute, make sure that the debug attribute is set to false.
Make sure that any Web page that contains a ScriptManager control has its ScriptMode property set to Release.
进一步研究 ScriptManager.ScriptMode:
The ScriptMode property specifies whether the ScriptManager control should render debug or release versions of client script libraries. This value can be superseded by values that are set in the configuration file and in the page directive.
...
[By default] Debug versions of client script libraries are used in the Web page when the retail attribute of the deployment configuration element is set to false. Otherwise, the release versions of client script libraries are used.
为了对此进行测试,我尝试将 ScriptMode
设置为 Release
并加载了正确的文件。