的Visual Studio 2015年的Razor视图MVC类型无法识别 [英] Visual Studio 2015 Razor View MVC Types not recognized

查看:1244
本文介绍了的Visual Studio 2015年的Razor视图MVC类型无法识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Visual Studio 2015年重新启动。在MVC类型不是在2015年确认,但在2013年仍然承认这是我的意见web.config中:

 <结构>
  < configSections>
    < sectionGroup NAME =system.web.webPages.razorTYPE =System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup,System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31BF3856AD364E35 >
      <节名称=主机TYPE =System.Web.WebPages.Razor.Configuration.HostSection,System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假 />
      <节名称=页面TYPE =System.Web.WebPages.Razor.Configuration.RazorPagesSection,System.Web.WebPages.Razor,版本= 2.0.0.0,文化=中性公钥= 31BF3856AD364E35requirePermission =假 />
    < / sectionGroup>
  < / configSections>  < system.web.webPages.razor>
    <主机factoryType =System.Web.Mvc.MvcWebRazorHostFactory,System.Web.Mvc,版本= 4.0.0.0,文化=中性公钥= 31BF3856AD364E35/>
    <页面pageBaseType =System.Web.Mvc.WebViewPage>
      <&命名空间GT;
        <添加命名空间=System.Web.Mvc/>
        <添加命名空间=System.Web.Mvc.Ajax/>
        <添加命名空间=System.Web.Mvc.Html/>
        <添加命名空间=System.Web.Optimization/>
        <添加命名空间=System.Web.Routing/>
      < /命名空间>
    < /页>
  < /system.web.webPages.razor>


解决方案

我们相信这些正在发生的,因为你目前正在使用MVC 4,和MVC 4工具不随Visual Studio 2015年只有5 MVC和MVC 6工装包括在内。如果你实际上使用MVC 5,看到这些问题,请告诉我们。你可以确认你正在使用MVC 4打开packages.config和滚动为Microsoft.AspNet.Mvc条目。如果列出的版本以4开头,这意味着你正在使用MVC 4。

说了这么多,我们的AP preciate您的反馈意见,并已在MVC 4.根据你和其他客户的反馈做出的投资,我们正在研究制定可用于Visual Studio 2015年MVC 4工具的可能性在此期间,您的项目将编译,尽管模具问题在Visual Studio 2015年运行。或者,您可以保留两个Visual Studio中你的机器并排侧安装的2013年和2015年。这样,你可以使用Visual Studio 2013年MVC 4个项目和Visual Studio 2015 MVC 5及以上的项目。

I installed Visual Studio 2015 and rebooted. The "MVC" types are not recognized in 2015 but are still recognized in 2013. This is my "Views" web.config:

<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>

解决方案

We believe these are occurring because you are currently using MVC 4, and MVC 4 tooling is not included with Visual Studio 2015. Only MVC 5 and MVC 6 tooling is included. If you are in fact using MVC 5 and seeing these issues, please do let us know. You can confirm you are using MVC 4 by opening packages.config and scrolling to the entry for Microsoft.AspNet.Mvc. If the version listed starts with "4", this means you are using MVC 4.

Having said that, we appreciate your feedback and the investment you have made in MVC 4. Based on yours and other customers’ feedback, we are looking into the possibility of making MVC 4 tooling available for Visual Studio 2015. In the meantime, your project will compile and run in Visual Studio 2015 despite the tooling issues. Alternatively, you can keep both Visual Studio 2013 and 2015 installed on your machine side-by-side. That way, you can use Visual Studio 2013 for MVC 4 projects and Visual Studio 2015 for MVC 5 and above projects.

这篇关于的Visual Studio 2015年的Razor视图MVC类型无法识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆