I have the following configured
我有如下配置。
Class called BudleConfig in the App_Code Folder
在App_Code文件夹中调用BudleConfig类。
Imports System.Web.Optimization
Public Class BundleConfig
Public Shared Sub RegisterBundles(bundles As BundleCollection)
bundles.Add(New ScriptBundle("~/bundles/WerbFormsJs").Include(
"~/js/Global.min.js",
"~/js/bootstrp.min.js"
))
End Sub
End Class
Next in a Global.asax
接下来在Global.asax
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
BundleConfig.RegisterBundles(BundleTable.Bundles)
End Sub
Finally in the Header User Control used on all pages
最后在页眉用户控件中使用。
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/WerbFormsJs") %>
</asp:PlaceHolder>
However, Scripts is giving me Build Errors - 'Scripts' is not declared. It may be inaccessible due to its protection level.
但是,脚本给了我构建错误——“脚本”没有被声明。由于它的防护等级,它可能无法进入。
I also added the following to the Web.config
我还在Web.config中添加了以下内容。
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
</pages>
1 个解决方案
#1
0
Had to fully qualify the Scripts.Render as follows:
必须完全限定脚本。呈现如下:
<%: Optimization.Scripts.Render("~/bundles/WerbFormsJs") %>
Problem resolved.
问题解决。
#1
0
Had to fully qualify the Scripts.Render as follows:
必须完全限定脚本。呈现如下:
<%: Optimization.Scripts.Render("~/bundles/WerbFormsJs") %>
Problem resolved.
问题解决。