MVC 4 @Scripts “does not exist”

后端 未结 24 1950
长发绾君心
长发绾君心 2020-12-12 11:20

I have just created an ASP.NET MVC 4 project and used Visual Studio 2012 RC to create a Controller and Razor Views for Index and Create Actions.

24条回答
  •  南方客
    南方客 (楼主)
    2020-12-12 12:02

    That has an obvious solution. I had the same problem later. Not related to Assembly References or ... .It'll occur In hierarchy calling of MVC Partial views, when you have complicated page structures. So calling/rendering each part separately on each page (maybe a master page or partial) will cause to not see required parts of page like the bellow code :

    @RenderSection("Scripts", required: false)
    

    That simply forces page to find and render related section and in case of failure shows you an error message like you.

    So I suggest you to trace your pages (like program trace) from master to all of its partials to Detect Dependencies. Maybe it be a terrible work, but no other choices available here.

    Not that according to my experience, some conditional situations in programming causes not to show you the right error causes the problem.

提交回复
热议问题