C# Razor视图引擎:如何告诉intellisense在哪里查找包程序集

C# Razor视图引擎:如何告诉intellisense在哪里查找包程序集,c#,.net,asp.net-mvc,razor,intellisense,C#,.net,Asp.net Mvc,Razor,Intellisense,我正在做一个很大的老项目,其中有很多ASP.NETMVC(框架)5 web项目。 尽管一切都很好,并且已经在生产环境中运行了很多年,但是维护它并不总是容易的,因为Razor Intellisense在View.csthml页面上无法正常工作。 例如,打开这样一个文件会 Severity Code Description Project File Line Suppression State Error CS0234 The type or namespace nam

我正在做一个很大的老项目,其中有很多ASP.NETMVC(框架)5 web项目。 尽管一切都很好,并且已经在生产环境中运行了很多年,但是维护它并不总是容易的,因为Razor Intellisense在View.csthml页面上无法正常工作。 例如,打开这样一个文件会

Severity    Code    Description Project File    Line    Suppression State
Error   CS0234  The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?) 4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'WebPages' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Optimization' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) 4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Routing' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0115  '_Page_Views_Language_Index_cshtml.Execute()': no suitable method found to override 4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'HttpApplication' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0103  The name 'Context' does not exist in the current context    4_Views_Language_Index.cshtml
Error   CS0234  The type or namespace name 'HttpApplication' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)  4_Views_Language_Index.cshtml
Error   CS0103  The name 'DefineSection' does not exist in the current context  4_Views_Language_Index.cshtml
Error   CS0103  The name 'ViewBag' does not exist in the current context    4_Views_Language_Index.cshtml
Error   CS0103  The name 'Model' does not exist in the current context  4_Views_Language_Index.cshtml
Error   CS0103  The name 'Url' does not exist in the current context    4_Views_Language_Index.cshtml
Error   CS0103  The name 'Url' does not exist in the current context    4_Views_Language_Index.cshtml
在尝试(+/-10小时)以下主题中提到的所有内容后 , , , 等等等等等等。 什么都没用。但所有的主题似乎都是关于编译错误,而不是智能感知错误

最终,我一次又一次地找到了原因。这似乎是因为我们将所有调试二进制文件编译到同一个目录中(这节省了大量磁盘空间)


真的
满的
假的
..\bin\
调试;痕迹
促使
4.
也就是说,到
。\bin\
,而不是在示例/默认MVC 5 web模板中找到的
bin\
。 这对于编译和运行调试非常有效。但它打破了理智

当我将
。\bin
目录复制到项目
bin
目录本地时,Razor Intellisense神奇地再次开始工作!也就是说,Razor Intellisense似乎总是在项目本地
bin\
目录中查找程序集,与项目设置无关

谁能告诉我如何让Razor Intellisense在
。\bin\
目录中查找程序集

编辑: 同时,我发现了有关此问题的更多信息:

这些都不是解决方案。。。他们只是通过将输出目录设置回
bin\
来“修复”。 我正在研究一个包含许多类库的大型整体,其中有几十个Razor类库,每个类库都有许多公共依赖项。将编译输出放入相同的
。\bin\
目录可节省大量硬盘空间