0

I have the following configured

Class called BudleConfig 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 a 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

<pages>
  <namespaces>
    <add namespace="System.Web.Optimization" />
  </namespaces>
</pages>

1 Answer 1

1

Had to fully qualify the Scripts.Render as follows:

 <%: Optimization.Scripts.Render("~/bundles/WerbFormsJs") %>   

Problem resolved.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.