VS 2015 IntelliSense: build error without a link

I just switched to VS 2015. I have an older MVC 5 application that works against 4.52. In VS 2013, it works great.

In VS 2015, I get red squigglies under my @Html.TextBoxFor() with an error indicating:

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

The project builds and works very well, but I am concerned about the IntelliSense error that never occurred in VS 2013. Good, so I try to add a link to System.Core, as recommended in the error above, and then I get this error:

Link to "System.Core" cannot be added. This component already automatically refers to the build system.

Again, this is normal in VS 2013.

+35
visual-studio-2015 intellisense
Jul 23 '15 at 10:23
source share
7 answers

I had the same problem, but at the same time I found the answer:

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

 <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> 

I also changed the target structure from 4.5.1 to 4.5.

ps Close and restart Visual Studio after changing it.

+40
Aug 26 '15 at 8:26
source share

I tried most of them, which ultimately worked for me: uploading the project, editing the csproj file and adding the following:

 <Reference Include="System.Core" /> 
+16
Jul 14 '16 at 10:37
source share

Only deleting the solution and getting the solution from the source control decided for me, deleting the .vs folder and starting VS2015, since "devenv.exe / resetuserdata" did not solve my problem, deleting the event from the MEF component cache was not resolved according to Razor intellisense answers do not work in VS 2015 .

+1
Oct 14 '15 at 12:54
source share

When upgrading from 4.5.2 to 4.6.1, I received exactly these errors in my views. Build and run the solution worked perfectly fine. After trying out all the solutions already published here (as well as checking the functionality of intellisense, clearing caches, deleting the bin and obj folders, loading and reloading the project), nothing happened (system.core was already built correctly and added these links to Web.config did nothing). I did my own digging and eventually found that in the project where the error occurred, the Web.config file contained two target compilation debug platforms and another target httpRuntime infrastructure. Like this:

 <system.web> <authentication mode="None" /> <compilation debug="true" targetFramework="4.6.1" /> <compilation debug="true" targetFramework="4.5.2" /> <httpRuntime targetFramework="4.5.1" /> ... 

The solution was to solve this problem by removing the additional compilation debugging target infrastructure and making sure that all the target platforms were the ones I wanted (4.6.1)

 <system.web> <authentication mode="None" /> <compilation debug="true" targetFramework="4.6.1" /> <httpRuntime targetFramework="4.6.1" /> ... 

Double check this if nothing works. Hope this helps someone!

+1
Sep 11 '18 at 9:39
source share

I tried these and other solutions in other threads. No one worked.

What was connected with the repair of the Visual Studio installation, which is located in the "System Settings", "Applications and Functions" submenus (click "VS" and select "Repair"). It took a couple of hours, but then the problem disappeared.

0
Jul 27 '16 at 16:12
source share

In my case, it worked after changing the <ProjectGuid> in the .csproj file to <ProjectGuid>{6C651A5E-8DDA-4680-804E-F9596743CBE8}</ProjectGuid> and reopening the solution. All of the solutions above did not help me.

0
Nov 23 '17 at 7:06
source share

If someone has encountered this problem with

VS 2017, .net Framework version 4.8 and MVC version 5.2.7

 Then check your Microsoft.CodeDom.Providers.DotNetCompilerPlatform version, If you have 2.0.1 version installed then downgrade it to 2.0.0 

enter image description here

Then check the MVC version, you should downgrade it to 5.2.4

enter image description here

 Then downgrade Microsoft.AspNet.WebPages 3.2.7 to Microsoft.AspNet.WebPages 3.2.4 and Microsoft.AspNet.Razor 3.2.7 to Microsoft.AspNet.Razor 3.2.4 

try to start the application now, it will work.

0
Aug 07 '19 at 11:34
source share



All Articles