MVC 4 @Scripts “does not exist”

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

    I had a very similar error when upgrading a project from MVC3 to MVC4.

    Compiler Error Message: CS0103: The name [blah] does not exist in the current context

    In my case, I had outdated version numbers in several of my Web.Configs.

    1. I needed to update the System.Web.Mvc version number from "3.0.0.0" to "4.0.0.0" in every Web.Config in my project.
    2. I needed to update all of my System.Web.WebPages, System.Web.Helpers, and System.Web.Razor version numbers from "1.0.0.0" to "2.0.0.0" in every Web.Config in my project.

    Ex:

    
      
        
    ...

    Be sure to review the Web.Configs in each of your Views directories.

    You can read more about Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4.

提交回复
热议问题