I have the following set up:
There is a Class named BundleConfig located in the App_Code Folder
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 the Global.asax file
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
BundleConfig.RegisterBundles(BundleTable.Bundles)
End Sub
Lastly, the Header User Control used on all pages has the following snippet
<asp:PlaceHolder runat="server">
<%: Scripts.Render("~/bundles/WerbFormsJs") %>
</asp:PlaceHolder>
However, I am facing Build Errors with Scripts - 'Scripts' is not declared. It may be inaccessible due to its protection level.
To address this issue, I also included the following code in the Web.config file
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
</pages>