VS 2015 IntelliSense:未引用程序集错误 [英] VS 2015 IntelliSense: Assembly Not Referenced Error

查看:104
本文介绍了VS 2015 IntelliSense:未引用程序集错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚切换到VS2015.我有一个较旧的MVC 5应用,可在4.52上运行.在VS 2013中,一切都很好.

I just switched to VS 2015. I have an older MVC 5 app that runs against 4.52. In VS 2013 it's perfectly fine.

在VS 2015中,我的@Html.TextBoxFor()下出现红色弯曲,错误指示:

In VS 2015 I'm getting red squigglies under my @Html.TextBoxFor() with an error indicating:

类型'Expression<>'是在不属于程序集的程序集中定义的 参考.您必须添加对程序集'System.Core的引用, 版本= 4.0.0.0,文化=中性,PublicKeyToken = b77a5c561934e089'.

The type 'Expression<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

该项目的构建和运行正常-但我担心VS 2013中从未发生过的IntelliSense错误.好吧,所以我尝试按照上述错误中的建议添加对System.Core的引用,然后得到此错误:

The project builds and runs just fine -- but I am concerned about the IntelliSense error that never happened in VS 2013. Okay, so I try to add the reference to System.Core as recommended in the error above and then I get this error:

无法添加对"System.Core"的引用.该组件是 已由构建系统自动引用.

A reference to 'System.Core' could not be added. This component is already automatically referenced by the build system.

同样,在VS 2013中也可以.

Again, this is fine in VS 2013.

推荐答案

我遇到了同样的问题,但与此同时,我找到了答案:

I had the same issue, but in the mean time I've found the answer:

我必须将以下引用添加到我的web.config中(添加到打开的system.web标记内):

I had to add the following references to my web.config (add inside the opening system.web tag):

<compilation debug="true" targetFramework="4.5">
    <assemblies>
                <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                <add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                <add assembly="System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />   
                <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Helpers, Version=3.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.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                <add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            </assemblies>
        </compilation>

我还将目标框架从4.5.1更改为4.5.

I also changed the target framework from 4.5.1 to 4.5.

p.s更改后关闭并重新打开Visual Studio.

p.s Close and reopen Visual Studio after changing it.

这篇关于VS 2015 IntelliSense:未引用程序集错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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