Razor Views not seeing System.Web.Mvc.HtmlHelper

后端 未结 22 1170
我在风中等你
我在风中等你 2020-11-27 05:27

I am in the process of upgrading to MVC4. I have followed the instructions at http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253806 but in my Razor views and layou

22条回答
  •  悲&欢浪女
    2020-11-27 05:50

    I ran into this issue with a Web Application - my .cshtml files got stuck on the System.Web.WebPages.WebViewPage base class when I needed the System.Web.Mvc.WebViewPage.

    First, ensure your ~/Views/web.config file has the correct pageBaseType. In my case, I set to System.Web.Mvc.WebViewPage.

    
      
        
          
        
      
    
    

    Then, importantly, some people have found this is key if the above is already good:

    1. Run a clean on the solution
    2. Unload the project with the issues
    3. Delete the .user file that Visual Studio generated next to the project.
    4. Reload the project with the issues
    5. Build the solution

    For VS2015, the .user and .sln files have moved to the .vs hidden folder that is created next to the .sln file. However, from comments below, the error messages imply to me that the tooling is using the wrong version of MVC entirely, and deleting this folder does not fix the issue. To my knowledge, there is not a known solution.

提交回复
热议问题