简体   繁体   English

Razor intellisense在vs2013中不起作用

[英]Razor intellisense does not work in vs2013

The Razor intellisense stopped working in one MVC 4 project, and one project only on my pc. Razor intellisense停止在一个MVC 4项目中工作,而一个项目仅在我的PC上工作。 I use Visual Studio 2013 Professional. 我使用Visual Studio 2013专业版。 I know this is an issue that has happened to a lot of people before me. 我知道这是我之前很多人都遇到的问题。 I've tried many possible solutions, but the one that works for me has not been there yet... 我尝试了许多可能的解决方案,但尚未找到适合我的解决方案...

A list of what I tried so far: 到目前为止我尝试过的清单:

  • Delete the temporary .suo file 删除临时.suo文件
  • In tools->options check Auto list members 在工具->选项中,选中自动列出成员
  • Remove the project from the solution and add it back 从解决方案中删除项目,然后重新添加
  • Create a new Visual Studio MVC project and copy the web.config file 创建一个新的Visual Studio MVC项目并复制web.config文件
  • Delete old Visual Studio 2010 settings in AppData/Roaming/Windows/Visual Studio 在AppData / Roaming / Windows / Visual Studio中删除旧的Visual Studio 2010设置
  • Change MVC version in web.config file in Views folder 在Views文件夹的web.config文件中更改MVC版本
  • Clean the solution, exit VS, reopen it and rebuild entire solution 清理解决方案,退出VS,重新打开它并重建整个解决方案
  • Unload and reload the project within the solution 卸载并重新加载解决方案中的项目

and probably I tried more which I can't remember right now. 可能我尝试了更多我不记得的尝试。 Does anyone have another solution/tip to solve this? 有没有人有其他解决方案/提示来解决这个问题?

Suggested answers for this post which didn't work either: 此帖子的建议答案也无效:

  • Repair Visual Studio and reinstall ASP .NET MVC 修复Visual Studio并重新安装ASP .NET MVC

I've faced same kind of problem with different causes and solved as follow: 我遇到了各种原因不同的同类问题,并按以下方式解决:

  1. web.config in all views folders : I got a correct version of web.config creating a new Area in my project and using it in other view folders 所有视图文件夹中的web.config :我得到了正确版本的web.config,在我的项目中创建了一个新Area并在其他视图文件夹中使用了它
  2. Feature … cannot be used because it is not part of the ISO-2 C# language specification generally these kind of errors does not block compilation, but could be very annoying. 功能…不能使用,因为它不是ISO-2 C#语言规范的一部分,这些错误通常不会阻止编译,但可能会很烦人。 To solve this error I've added this segment in web.config (or in app.config if your project is not a web project) 为了解决此错误,我在web.config中添加了此段(如果您的项目不是Web项目,则在app.config中添加了此段)

    <system.web> <compilation debug="true" targetFramework="4.0"> <assemblies> <!-- ASP.NET 4.0 Assemblies --> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </assemblies> </compilation> </system.web>

  3. local assemblies : sometimes, when I've used external assemblies (for helpers eg) I've had to check for Copy Local = true in Project references. 本地程序集 :有时,当我使用外部程序集(例如用于帮助程序)时,我不得不在Project引用中检查Copy Local = true。

In all cases It could be needed to close/reopen VS to get the modification applied. 在所有情况下,都可能需要关闭/重新打开VS才能应用修改。 hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM