C # using System.Linq error

Why can "using System.Linq" cause the following error?

Linq namespace type or name does not exist in System namespace

+7
source share
9 answers

System.Core Link

And then there are others who also combine this namespace, but the main one is on .Net 3.5 and higher.

If you are a project currently .Net 2.0, say, and you are using the correct version of VS (2005 and above) - you can just right-click on the properties of the proejct; and change the "Target Framework Version" to 3.5. System.Core will become available.

If you do not see this in the parameters - then I assume that you are using an older VS

+15
source

The most likely reason is that you are using the wrong version of the .NET Framework.

+5
source

Try adding the System.Core assembly to your project.

+5
source

You will get this error if you do not have a link to "System.Core.dll" (an assembly containing the basic LINQ APIs).

+4
source

Perhaps you are guided by an earlier structure, Linq comes in with 3.5 IIRC.

+3
source

System.Linq is available in .Net version 3.5 and higher.

+3
source

You are using a lower version of the .NET Framework than 3.5 to compile the source code, or you did not add the System.Core assembly to your project.

+3
source

Manually enter using System.Linq at the beginning of the project; you will not be able to find this namespace in the additional link dialog box. If you still get the error, try adding the System.Core link. If you get an error message that has already been indicated, you can unload the project, and then edit the csproject file, copy the link to the System tag and copy the link and change the name to System.Core and reload the project.

0
source

In my case, the only thing that worked was:

Adding a new Razor item (e.g. MVC 5 view page)

Add new Razor item

This automatically pulls in some NuGet packages

installed NuGet packages

The package that makes System.Linq available to Razor Views IntelliSense seems to be Microsoft.AspNet.WebPages .

0
source

All Articles