[英]ASP.NET Web site (NOT WEB APP) Bundle js and css
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>
Had to fully qualify the Scripts.Render as follows: 必须完全符合Scripts.Render的要求,如下所示:
<%: Optimization.Scripts.Render("~/bundles/WerbFormsJs") %>
Problem resolved. 问题已解决。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.