MVC 4 @Scripts “does not exist”

后端 未结 24 1992
长发绾君心
长发绾君心 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:10

    I upgraded from Beta to RC and faced 'Scripts' does not exist issue. Surfed all over the web and the final solution is what N40JPJ said plus another workaroudn:

    Copy the following in View\Web.config :

      
        
        
        
        
        
        
      
    

    and the following inside View\Shared_Layout.cshtml

    @if (IsSectionDefined("scripts")) 
    {
           @RenderSection("scripts", required: false)
    }
    

    Hope it helps.

提交回复
热议问题