简体   繁体   English

Visual Studio 2012在MVC 4 Razor视图中丢失了智能感知

[英]Visual Studio 2012 loses intellisense in MVC 4 Razor views

I'm developing a project with plug in ASP.MVC architecture. 我正在开发一个带有ASP.MVC体系结构插件的项目。 We use one main web application project and multiple subprojects. 我们使用一个主要的Web应用程序项目和多个子项目。 My problem is following - Visual Studio loses intellisense in MVC views in a subproject. 我的问题如下-Visual Studio在子项目的MVC视图中丢失了智能感知。 On one developer machine it works while on another it doesn't. 在一台开发机上,它可以工作,而在另一台开发机上则不能。 I know we need some NuGet packages to be installed, I know we need Web.config in Views directory. 我知道我们需要安装一些NuGet软件包,我知道我们需要Views目录中的Web.config。 It's all configured and still after moving into another developer machine it stops working. 全部配置完毕,移入另一台开发人员计算机后仍然无法工作。

I've tried: 我试过了:

  • IIS reset IIS重置
  • Visual Studio reset Visual Studio重置
  • Running visual studio with elevated privileges 以更高的权限运行Visual Studio
  • PC reboot PC重启
  • Creating new web project 创建新的Web项目
  • Deleting suo file 删除suo文件
  • Deleting csproj.user file 删除csproj.user文件
  • Installing ASP.NET and Web Tools 2013.1 for Visual Studio 2012 为Visual Studio 2012安装ASP.NET和Web工具2013.1
  • Reseting VS environment settings 重置VS环境设置

And still when I run project in other developer machine it doesn't support intellisense in my subproject. 而且,当我在其他开发人员机器上运行项目时,它在我的子项目中也不支持intellisense。

I had the same issues. 我有同样的问题。 When codebase is large, intellisense can be lost. 当代码库很大时,智能感知可能会丢失。

Some of developers in our team were struggling with that for a long time. 我们团队中的一些开发人员为此苦苦挣扎了很长时间。 But installed Resharper . 但安装了Resharper It always worked fine for us after that. 在那之后,它对我们一直很好。

I think you have to wait for a patch, or install try to install Resharper, it's free for 30 days. 我认为您必须等待补丁程序,或者安装尝试安装Resharper的软件,它免费提供30天。

Finally I've found a solution. 终于我找到了解决方案。 I've modified Web.config of subproject and added following code to it: 我已经修改了子项目的Web.config并向其中添加了以下代码:

<compilation debug="true" targetFramework="4.5">
      <!-- New -->
      <assemblies>
        <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>

I also changed web subproject properties, on the Web tab I unchecked "Apply server settings to all users (store in project file)". 我还更改了Web子项目的属性,在“ Web”选项卡上,我未选中“将服务器设置应用于所有用户(存储在项目文件中)”。

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

相关问题 MVC 4 IntelliSense在Visual Studio 2010中无法在Razor中运行 - MVC 4 IntelliSense is not working in Razor in Visual Studio 2010 Visual Studio 2012和Intellisense - Visual Studio 2012 and Intellisense Visual Studio、Razor、BuildProviders 和 Intellisense - Visual Studio, Razor, BuildProviders and Intellisense 使用Visual Studio 2012 RC的MVC 4 / Razor中的可移植类库? - Portable Class Library in MVC 4 / Razor with Visual Studio 2012 RC? 在MVC 5视图Visual Studio 2015 Enterprise中未解析Razor引用 - Razor references not resolved in MVC 5 views Visual Studio 2015 Enterprise Visual Studio 2015 Broken Razor Intellisense - Visual Studio 2015 Broken Razor Intellisense “@ Model”,“@ Viewbag”和“@Url”“在当前上下文中不存在”使用Visual Studio 11 Beta / Visual Studio 2012 RC时的Razor MVC3 - “@Model”, “@Viewbag” and “@Url” “does not exist in the current context” Razor MVC3 when using Visual Studio 11 Beta/Visual Studio 2012 RC Visual Studio 2015 不是语法高亮剃刀,也不是 Intellisense - Visual Studio 2015 not syntax highlighting razor nor Intellisense Visual Studio 2012 MVC 3多个不需要的线程 - Visual Studio 2012 MVC 3 multiple unwanted threads Visual Studio 2012调试MVC 4访问被拒绝 - Visual Studio 2012 Debugging MVC 4 Access Denied
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM