0

When I start a fresh Empty C# MVC .NET 4.6 project with the folders and references for MVC. I add the reference to my data library and proceed to create a new Controller with EF and create Views. Once VS has done its thing, I open up one of the created views (Edit in this case) and parts of the Razor syntax are underlined and it tells me that my System.Core isn't referenced. I see it referenced but the only thing that solves this is adding a System.Core.dll to my bin folder. Pretty sure that shouldn't be happening.

Now if I create my own empty controller and view separate, there is no issue. I'm fine taking that approach but I'd LOVE to know why it's not working the other way or how I can restore the System.Core reference on an older much larger project without adding that DLL manually. I've burned over a day on this problem already.

Here's a SS of the error. I've tried reboots and resetting the VS environment but no luck.

enter image description here

Tom V
  • 453
  • 4
  • 12
  • Check if the `System.Core.dll` referenced is of the same version .Net 4.6. You will have reference errors if they are of different .net framework version. – Carbine Feb 23 '16 at 15:01
  • If it is an older project (.Net 3.5) they changed where the `System.Core` namespace was defined. If I remember rightly, it used to be in `System`/`mscorlib` but now it is a separate assembly. You may be referencing the wrong version of the assemblies. The other thing to check is that you have a reference to `System.Core` in the `web.config` in the `Views` folder.. it will be under the `` section. – Michael Coxon Feb 23 '16 at 15:02
  • This was a completely new .NET 4.6 project. Nothing fancy had been done to it. Why would adding the scaffolding just remove the DLL. It shows in my references list that System.Core is still being referenced. – Tom V Feb 23 '16 at 15:18

0 Answers0