After updating the bootstrap this error appears when I try to run a view why? The object reference has not been defined as an instance of an object.

GILBERTO GEOFRAGAS 6 Reputation points
2022-01-18T18:17:21.08+00:00

165989-errobootstrap.png

ASP.NET MVC
ASP.NET MVC
A Microsoft web application framework that implements the model-view-controller (MVC) design pattern.
736 questions
No comments
1 vote

4 answers

Sort by: Most helpful
  1. Michael Taylor 41,191 Reputation points
    2022-01-18T19:51:43.787+00:00

    You're using server side bundling. That means you have a BundleConfig.cs or similar file in your code where the bundles are defined. If you look in that file then it'll have a bundle defined for Bootstrap. Often when using server side bundling the code references the JS files and those files are contained in a versioned-path. If you updated bootstrap then you need to ensure you also updated the bundle configuration to use the new path otherwise you'll get runtime errors.

    1 person found this answer helpful.
    No comments

  2. Yijing Sun-MSFT 7,026 Reputation points
    2022-01-19T01:54:37.087+00:00

    Hi @GILBERTO GEOFRAGAS ,
    I think,you need to check your bootstrap.js in BundleConfig.cs inside App_Start folder. Just like this:

                bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(  
                          "~/Scripts/bootstrap.js"));  
    

    Best regards,
    Yijing Sun


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    No comments

  3. Prince Mathew 36 Reputation points
    2022-06-25T17:24:32.73+00:00

    Bootstrap v5 has no dependency on Jquery anymore so, I think including jquery and bootstrap.js in the same bundle object causes this issue. Check this URL: https://blog.webnersolutions.com/nuget-packages-update-scripts-bundle-error-caused-by-bootstrap-5-x-in-net-mvc-application/

    1 person found this answer helpful.
    No comments

  4. Prince Mathew 36 Reputation points
    2022-06-26T11:15:58.877+00:00

    If this issue is not resolved yet you can use the traditional way of approach, like in the image.

    214949-script.png

    1 person found this answer helpful.
    No comments