Disable scriptmanager script console in development?

On an ASP.NET site, I have a ScriptManager control on the main page, and ScriptManagerProxy is managed everywhere. In most cases, I use the <compositescript> block to combine scripts into a single file.

Core.master

 <asp:scriptmanager id="ScriptManager1" runat="server" > <compositescript> <scripts> <asp:scriptreference path="script1.js" /> <asp:scriptreference path="script2.js" /> ... etc ... </scripts> </compositescript> </asp:scriptmanager> 

Sample or Content Control Page

 <asp:scriptmanagerproxy runat="server"> <compositescript> <scripts> <asp:scriptreference path="script3.js" /> <asp:scriptreference path="script4.js" /> ... etc ... </scripts> </compositescript> </asp:scriptmanagerproxy> 

This works great, but for the effective use of Visual Studio client-side debugging tools, I would prefer not to consolidate the scripts during development.

I tried just moving all the scripts from <compositescripts> to <scripts> , this way:

  Private Sub ScriptManager1_PreRender(sender As Object, e As System.EventArgs) Handles ScriptManager1.PreRender ' In development, don't combine scripts If IsDevelopmentEnvironment() Then For Each s As ScriptReference In ScriptManager1.CompositeScript.Scripts.Reverse ScriptManager1.Scripts.Insert(0, s) Next ScriptManager1.CompositeScript.Scripts.Clear() End If End Sub 

This works like a charm for scripts of ScriptManager itself. However, he does not see scripts in the various ScriptManagerProxy controls, and they still become consolidated. During debugging, I can see the ScriptManager1.Proxies collection, which I would like to skip, but it is a "Friend", so I can not access it in the code.

Disabling consolidation in development seems like a pretty obvious requirement, so maybe there is a much more obvious way to do this, which I'm just missing?

+4
source share
1 answer

Is there ScriptMode = "Debugging" versus release work?

0
source

Source: https://habr.com/ru/post/1381803/


All Articles