Razor Views not seeing System.Web.Mvc.HtmlHelper

后端 未结 22 1169
我在风中等你
我在风中等你 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 05:53

    I used the following article on MSDN to solve this issue (in this case from MVC 4 to MVC 5)

    https://docs.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

    Main extracts from the article are:

    Main Web.config (Not the one in the Views folder)

    In the runtime block update System.Web.Mvc to 5.0.0.0 ,System.Web.Helpers to 3.0.0.0 and System.Web.WebPages to 3.0.0.0

    
      
      
    
    
    
      
      
    
    
    
      
      
    
    

    Then look for the appsettings block and update the webpages:Version value to 3.0.0.0

    
        
    
    

    Views Web.config

    Update the host factoryType block to System.Web.Mvc to 5.0.0.0

    
       
       
          
             
          
       
    
    

    Then under the pages block update any references to System.Web.Mvc to 5.0.0.0

        
        
          
        
      
    

    And finally under the configuration block update the System.Web references to 3.0.0.0

    
      
        
          

提交回复
热议问题