MVC 4 @Scripts “does not exist”

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

    When i started using MVC4 recently i faced the above issue while creating a project with the empty templates. Steps to fix the issue.

    1. Goto TOOLS --> Library Package Manager --> Packager Manager Console Paste the below command and press enter Install-Package Microsoft.AspNet.Web.Optimization Note: wait for successful installation.
    2. Goto Web.Config file in root level and add below namespace in pages namespace section. add
    3. Goto Web.Config in Views folder and follow the step 2.
    4. Build the solution and run.

    The Package mentioned in step 1 will add few system libraries into the solution references like System.Web.Optimization is not a default reference for empty templates in MVC4.

    I hope this helps. Thank you

提交回复
热议问题